0
votes

Stuck at a specific measure calculation which looks like this in tableau

1.) zn(COUNTD(if not isnull([Order_number]) then [Order_number] END)).

I tried using isblank dax function but it is not working as i expected it to be. How will the same measure be written in Powerbi using DAX?

Problem 2
Simultaneously, not able to get the output for a particular calculated column in powerbi for which the tableau query to derive that particular column looks like this:

2.) zn(IF CONTAINS([Record Type],"High") and datename('weekday',[Activity Date]) = 'Sunday' AND [Location] = '08520' THEN 7 ELSEIF CONTAINS([Record Type],"Junior") and datename('weekday',[Activity Date]) = 'Sunday' AND [Location] = '8520' THEN 7 end

I re created the above by Creating a custom column named it as Day Name deriving day name from the date column and Wrote an equivalent query in Powerbi query editor to create a custom column, query mentioned below. Even though there is no syntax error, it is giving 0 for all the rows in that particular calculated column.

slots= if([RECORD_TYPE]="high" and [Day Name]="Sunday" and [LOCATION]=08520) then 7 else
if([RECORD_TYPE]="Outbound" and [Day Name]="Sunday" and [LOCATION]=3109) then 7 else 0

Any kind of lead or help will be much appreciated.

Thanks in advance

1

1 Answers

0
votes

For 1st problem:

zn(COUNTD(if not isnull([Order_number]) then [Order_number] END))

So, If i break this query basically, zn is a function used in tableau to convert all the null values to zero and as countd implies to the entire if statement above.
I was able to write an equivalent dax query for it mentioned below, if anyone out there can tell me or verify if it is correct or not, I'll be really thankful.

IF(ISBLANK(DISTINCTCOUNT(Order_table[ORDER_NUMBER])),0,DISTINCTCOUNT(Order_table[ORDER_NUMBER]))

As far as the second problem goes, im not able to find a solution to it and the value for that column for all the rows stands at 0 as I'm writing this answer to 1st problem. Any kind of help or lead will be much appreciated.

Thanks