Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello all,
I have a report where I need to show a variance based on selections in two date slicers. See screenshot. I have a single fact table connected to a date table. That single date table is used to populate both slicers, and those slicers interact visually with each table based on the selection. For the "Variance" measure, I've tried all manner of things based on search results, but none seem to pinpoint my exact (and hopefully simple) need here. I won't muddy the waters by showing what I've already tried.
In the sample below, the expected result should be 0.03. Can anyone point me in the right direction here? Thanks in advance!
Solved! Go to Solution.
Hi @wbhite ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
Fact table:
Calendar table:
CALENDAR = CALENDAR(DATE(2023,1,1),DATE(2023,12,31))
(2) We can create a table and a measure.
CALENDAR Table2 = VALUES('CALENDAR'[Date #1])
Material cost =
var _a=CALCULATE(MAX('Fact Table'[total material cost]),FILTER(ALL('Fact Table'),'Fact Table'[date]=SELECTEDVALUE('CALENDAR'[Date #1])))
var _b=CALCULATE(MAX('Fact Table'[total material cost]),FILTER(ALL('Fact Table'),'Fact Table'[date]=SELECTEDVALUE('CALENDAR Table2'[Date #2])))
return _b-_a
(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
I cannot understand your requirement. Why in the first place do you have 2 date slicers? Do you want to compare the cost of 2 products between a week of each other?
Hi @wbhite ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
Fact table:
Calendar table:
CALENDAR = CALENDAR(DATE(2023,1,1),DATE(2023,12,31))
(2) We can create a table and a measure.
CALENDAR Table2 = VALUES('CALENDAR'[Date #1])
Material cost =
var _a=CALCULATE(MAX('Fact Table'[total material cost]),FILTER(ALL('Fact Table'),'Fact Table'[date]=SELECTEDVALUE('CALENDAR'[Date #1])))
var _b=CALCULATE(MAX('Fact Table'[total material cost]),FILTER(ALL('Fact Table'),'Fact Table'[date]=SELECTEDVALUE('CALENDAR Table2'[Date #2])))
return _b-_a
(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is great, thanks so much!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
84 | |
84 | |
73 | |
49 |
User | Count |
---|---|
143 | |
132 | |
110 | |
64 | |
55 |