The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I am new to DAX functions and have the following question.
I have FY, Geo, Country, All Site, last touch channel, Visit number as my filters. My goal is to have two straight lines on the chart. One with AVG + 3* STD DEV and another with AVG - 3* STD DEV.
This is working correctly if I select one country but if I select multi countries, the calculation is wrong. Ideally, I should be able to multiselect all the filters. Below are the formulas I am using.
@bcdobbs I tried your suggestion and have posted the response above. Could you please have a look? Thank you.
@amitchandak tagging you here as you had helped with a similar problem. Could you please have a look as well? Thank you.
@bcdobbs Thank you for your response.
I tried using REMOVEFILTERS and VALUES as show below but the result is the same. When I select more than one country, the max and min values are not accurate.
I suspect although it's hard to test without a demo pbix file that your issue might be caused by your use of ALLEXCEPT.
Try replacing ALLEXCEPT with a combination of REMOVEFILTERS and VALUES in both measures:
Std Dev =
CALCULATE(
STDEV.P( Top_Sites_Data[Visits] ),
REMOVEFILTERS( Top_Sites_Data ),
VALUES( Top_Sites_Data,Top_Sites_Data[GEO] ),
VALUES( Top_Sites_Data[Country] ),
VALUES( Top_Sites_Data[Segment] ),
VALUES( Top_Sites_Data[All Site vs Top Site] ),
VALUES( Top_Sites_Data[Last Touch Channel] ),
VALUES( Top_Sites_Data[Visit Number] ),
VALUES( Top_Sites_Data[Fiscal Year] )
)
Alternatively depending on how mnay columns are in the table just use REMOVEFILTERS to remove filters from the "other" columns.
If that doesn't work come back and we'll look again. I did wonder if you were having issues due to your country hierachy creating an arbitrarily shaped set.
Explanation for why this might help is in:
Using ALLEXCEPT versus ALL and VALUES - SQLBI
User | Count |
---|---|
25 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
27 | |
12 | |
12 | |
12 | |
6 |