The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I am trying to convert some dashboards that are in Tableau over to Power BI. I am still learning DAX functionalities but how would I convert the below calculated field to a DAX query?
Hi @yohanp17190 ,
Based on the formula, it appears that you are trying to count the number of unique TotalInteractionNumber values for each quarter, where the TotalInteractionNumber is not equal to 'LEAD000001CH000001', the HoldFlag is 1, and the ActiveCampaignFlag is 1 for quarters after '18-Q4', and where the TotalInteractionNumber is not equal to 'LEAD000001CH000001' and the HoldFlag is 1 for quarters before '18-Q4'.
Please have a try.
column=
CALCULATE(
COUNTROWS(
FILTER(
'Table',
'Table'[TotalInteractionNumber] <> "LEAD000001CH000001" &&
'Table'[HoldFlag] = 1 &&
(
'Table'[ActiveCampaignFlag] = 1 &&
'Table'[Quarter] >= "18-Q4" ||
'Table'[Quarter] < "18-Q4"
)
)
),
ALL('Table'[Quarter])
)
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Share some data, explain the question and show the expected result.
@amitchandak Thank you for your quick response. I did try to plug in the query that you provided but I dont think it is giving me the right output.
I was given an explanation of what that calculated field is supposed to do.
It is supposed to count the [TotalInteractionNumber] field, which is an ID field, only once for each quarter along with the other filters that have been applied.
Would really appreciate it if you could help me with modifying your previous query. Ive been watching your videos and they have been really helpful.
@yohanp17190 , check if , this approch can help
LOD Include (Level Of Details): https://youtu.be/nmBVc2fN6aU
Use countx in this case with filter
example
CALCULATE(
COUNTX(VALUES('Table'[Quarter]), [Quarter]),
FILTER(
ALL('Table'),
[Quarter] < ( "18-Q4") &&
[TotalInteractionNumber] <> "LEAD000001CH000001" &&
[HoldFlag] = 1 &&
[ActiveCampaignFlag] = 1
)
)