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 All,
i have a huge dataset with two labels 2019 and 2020, i would like to get the difference of count ie- for the below example - output = 3-2= 1 so if i use Card visual, i should be getting 1
class
2019
2019
2019
2020
2020
TIA
Solved! Go to Solution.
@Anonymous , better to have a separate Year table (Say Date)
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
or
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=2020))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=2019))
diff = [This Year]-[Last Year ]
Hello @Anonymous ,
Try this measure
Difference =
VAR Total2019 =
CALCULATE ( COUNT ( 'Year Table'[Year] ), 'Year Table'[Year] = 2019 )
VAR Total2020 =
CALCULATE ( COUNT ( 'Year Table'[Year] ), 'Year Table'[Year] = 2020 )
RETURN
Total2019 - Total2020
Hello @Anonymous ,
Try this measure
Difference =
VAR Total2019 =
CALCULATE ( COUNT ( 'Year Table'[Year] ), 'Year Table'[Year] = 2019 )
VAR Total2020 =
CALCULATE ( COUNT ( 'Year Table'[Year] ), 'Year Table'[Year] = 2020 )
RETURN
Total2019 - Total2020
@Anonymous , better to have a separate Year table (Say Date)
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
or
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=2020))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=2019))
diff = [This Year]-[Last Year ]
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
93 | |
90 | |
86 | |
76 | |
49 |
User | Count |
---|---|
166 | |
149 | |
99 | |
73 | |
57 |