Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have 5 DAX conditions and an IF condtion to return the measure result. The IF comparison condition is returning the result of only the month selected in Month slicer instead of returing last 3 months data when IF condition is True. The individual DAX conditions return correct result. The issue is in IF statement only. Can someone help?
BillDoc=
var Orders_1= CALCULATE(COUNTROWS(FILTER(SUMMARIZE('V2 Secondary Sales Fact','V2 Secondary Sales Fact'[Outlet ID],"Orders",CALCULATE(DISTINCTCOUNT('V2 Secondary Sales Fact'[Bill Document Number]))),[Orders]=1)))
var Orders_2= CALCULATE(COUNTROWS(FILTER(SUMMARIZE('V2 Secondary Sales Fact','V2 Secondary Sales Fact'[Outlet ID],"Orders",CALCULATE(DISTINCTCOUNT('V2 Secondary Sales Fact'[Bill Document Number]))),[Orders]=1)),DATEADD('Date'[FullDate], -1, MONTH))
var Orders_3= CALCULATE(COUNTROWS(FILTER(SUMMARIZE('V2 Secondary Sales Fact','V2 Secondary Sales Fact'[Outlet ID],"Orders",CALCULATE(DISTINCTCOUNT('V2 Secondary Sales Fact'[Bill Document Number]))),[Orders]=1)),DATEADD('Date'[FullDate], -2, MONTH))
var Orders_4= CALCULATE(COUNTROWS(FILTER(SUMMARIZE('V2 Secondary Sales Fact','V2 Secondary Sales Fact'[Outlet ID],"Orders",CALCULATE(DISTINCTCOUNT('V2 Secondary Sales Fact'[Bill Document Number]))),[Orders]=1)),DATEADD('Date'[FullDate], -3, MONTH))
var orders_3M=CALCULATE(COUNTROWS(FILTER(SUMMARIZE('V2 Secondary Sales Fact','V2 Secondary Sales Fact'[Outlet ID],"Orders",CALCULATE(DISTINCTCOUNT('V2 Secondary Sales Fact'[Bill Document Number]))),[Orders]=1)), DATESINPERIOD('Date'[FullDate],MAX('Date'[FullDate]),-3,MONTH))
return
if(((Orders_1>=Orders_2)&&(Orders_2>=Orders_3)&&(Orders_3>=Orders_4)),orders_3M, BLANK())
Hi @Anonymous
Could you provide me with your data model and show me the screenshot of your issue?
Or you can provide me with your pbix file by your Onedrive for Business. You can tell me your calculate logic in you measure.
This may make it easier for me to understand what result you want.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Proud to be a Super User!
The variable orders_3M in IF condition- if(((Orders_1>=Orders_2)&&(Orders_2>=Orders_3)&&(Orders_3>=Orders_4)),orders_3M, BLANK()) is not returning last 3 months data based on month slicer selection.
For ex- For month selection Apr, it returns data of Feb and Apr instead of Feb, Mar, Apr.
(Orders_1>=Orders_2)&&(Orders_2>=Orders_3)&&(Orders_3>=Orders_4) condition holds TRUE.
I am using this measure in a Column chart with Values as the 'measure name' and Axis as 'month'.
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
81 | |
70 | |
61 |
User | Count |
---|---|
148 | |
116 | |
104 | |
89 | |
65 |