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.
Hi all
I want to calculate the difference between values, based on the date as well as another categorial variable.
All that should be displayed in a waterfall diagram (column Expected Result). I attached a screenshot with dummy data and the expectet outcome.
Thanks in advance!
Solved! Go to Solution.
Hi @Anonymous ,
Based on your description, you can do some steps as follows.
Month = MONTH('Diff'[Date])
2. Create a new measure.
Test Value =
var x1=MAXX(FILTER(ALL(Diff),[Month]=SELECTEDVALUE(Diff[Month])&&'Diff'[Cat]=SELECTEDVALUE(Diff[Cat])),'Diff'[Value])
var x2=MAXX(FILTER(ALL(Diff),[Month]=SELECTEDVALUE(Diff[Month])-1&&'Diff'[Cat]=SELECTEDVALUE(Diff[Cat])),'Diff'[Value])
return
x1-x2
Result:
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Try this calculated column formula
=data[value]-lookupvalue(data[value],data[date],calculate(max(data[date]),filter(data,data[cat]=earlier(data[cat])&&data[date]<earlier(data[date]))),data[cat],data[cat])
Hope this helps.
Hi @Anonymous ,
Based on your description, you can do some steps as follows.
Month = MONTH('Diff'[Date])
2. Create a new measure.
Test Value =
var x1=MAXX(FILTER(ALL(Diff),[Month]=SELECTEDVALUE(Diff[Month])&&'Diff'[Cat]=SELECTEDVALUE(Diff[Cat])),'Diff'[Value])
var x2=MAXX(FILTER(ALL(Diff),[Month]=SELECTEDVALUE(Diff[Month])-1&&'Diff'[Cat]=SELECTEDVALUE(Diff[Cat])),'Diff'[Value])
return
x1-x2
Result:
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, thank you very much for your help!! It worked perfectly 🙂
Thanks again!
@Anonymous , Try a new column like
new column =
var _max = maxx(filter(Table, [cat] =earlier([cat]) && [Date] <earlier([Date])),[Date])
return
[value] - maxx(filter(Table, [cat] =earlier([cat]) && [Date] =_max),[value])
@amitchandakThank you very much for your reply!
Unfortunately I get an error ("syntax for return is incorrect").
Thanks again 🙂
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 |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |