Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have a formula like this to calculate percentages which can be changing dynamically with age, gender filters. But there are some 'DATA'[XXX] with missing values "." and I want to exclude those missing values in the denominator. How can I do that?
Thanks!
Lai
Percentage =
DIVIDE(
calculate(sum('DATA'[Weight]),filter('DATA','DATA'[XXX]="Yes"&&'DATA'[Age]=[Selected_Age]&&'DATA'[Gender]=[Selected_Gender])),
calculate(sum('DATA'[Weight]), allexcept('DATA','DATA'[Year],'DATA'[Age],'DATA'[Gender]))
)
Solved! Go to Solution.
add the
DATA[XXX]<>"."
to your denominator calculate, like this:
DIVIDE ( CALCULATE ( SUM ( 'DATA'[Weight] ), FILTER ( 'DATA', 'DATA'[XXX] = "Yes" && 'DATA'[Age] = [Selected_Age] && 'DATA'[Gender] = [Selected_Gender] ) ), CALCULATE ( SUM ( 'DATA'[Weight] ), ALLEXCEPT ( 'DATA', 'DATA'[Year], 'DATA'[Age], 'DATA'[Gender] ), DATA[XXX] <> "." ) )
hello,
this solution of removing missing in calculate function (dax) doesn't seem to work for me. Perhap because the calculate is based on other measures which already have filter in them. I ended up just using simple If(isblank(variable), blank(), calculate(variable - variable2).
add the
DATA[XXX]<>"."
to your denominator calculate, like this:
DIVIDE ( CALCULATE ( SUM ( 'DATA'[Weight] ), FILTER ( 'DATA', 'DATA'[XXX] = "Yes" && 'DATA'[Age] = [Selected_Age] && 'DATA'[Gender] = [Selected_Gender] ) ), CALCULATE ( SUM ( 'DATA'[Weight] ), ALLEXCEPT ( 'DATA', 'DATA'[Year], 'DATA'[Age], 'DATA'[Gender] ), DATA[XXX] <> "." ) )
Thank you! This is very helpful!
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
11 | |
9 | |
6 |