March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I'm trying to do a comparison with card visual to show % of changes between YTD average # and day with option to select the day.
Daily Avg $ YTD | 10/19/21 (Previous Day) | % change |
$1,078 | $1,008 | -6.5% |
Solved! Go to Solution.
Hi @nhoang
Here you need to create a measure to calculate the YTD Average which won't be filtered by your slicer. Try "ALL" function in your code.
My Sample:
Measures:
YTD Average =
CALCULATE (
DIVIDE ( SUM ( 'Table'[Value] ), DISTINCTCOUNT ( 'Table'[Date] ) ),
FILTER ( ALL ( 'Table' ), YEAR ( 'Table'[Date] ) = YEAR ( TODAY () ) )
)
SELECT Value = SUM('Table'[Value])
% =
VAR _DIFF = [SELECT Value] - [YTD Average]
VAR _Percentage = DIVIDE(_DIFF,[YTD Average])
RETURN
_Percentage
Result is as below.
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.
Can you elaborate on this? What is it that you want to accomplish here?
I have a YTD average I would like to compare to selected date amount.
YTD Average | Select Date | % |
7698 | 10029 | 30.3% |
Hi @nhoang
Here you need to create a measure to calculate the YTD Average which won't be filtered by your slicer. Try "ALL" function in your code.
My Sample:
Measures:
YTD Average =
CALCULATE (
DIVIDE ( SUM ( 'Table'[Value] ), DISTINCTCOUNT ( 'Table'[Date] ) ),
FILTER ( ALL ( 'Table' ), YEAR ( 'Table'[Date] ) = YEAR ( TODAY () ) )
)
SELECT Value = SUM('Table'[Value])
% =
VAR _DIFF = [SELECT Value] - [YTD Average]
VAR _Percentage = DIVIDE(_DIFF,[YTD Average])
RETURN
_Percentage
Result is as below.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
168 | |
116 | |
63 | |
57 | |
50 |