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,
I have a table like this
Id | Amount | DateInserted |
1 | 20 | 31/03/2022 |
1 | 10 | 30/04/2022 |
2 | 50 | 30/04/2022 |
2 | 20 | 31/03/2022 |
3 | 30 | 30/04/2022 |
3 | 40 | 31/03/2022 |
and a slicer for the dateinserted.
When I chose Apr-2022, it should show data like this
Id | Current Amount | Previous Amount |
1 | 10 | 20 |
2 | 50 | 20 |
3 | 30 | 40 |
How do I achieve this?
Solved! Go to Solution.
Hi @bml123 ,
You can use this function PREVIOUSMONTH to get the data.
Please refer the following expression:
Previous Amount =
CALCULATE (
SUM ( Amount[Amount] ),
ALLEXCEPT ( Amount, Amount[Id] ),
PREVIOUSMONTH ( Amount[DateInserted] )
)
The expression provided by@Anonymous works fine too, however, it maybe some mistake when the table has two years data.
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @bml123 ,
You can use this function PREVIOUSMONTH to get the data.
Please refer the following expression:
Previous Amount =
CALCULATE (
SUM ( Amount[Amount] ),
ALLEXCEPT ( Amount, Amount[Id] ),
PREVIOUSMONTH ( Amount[DateInserted] )
)
The expression provided by@Anonymous works fine too, however, it maybe some mistake when the table has two years data.
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @bml123
You can use this measure
Here's what i got
if this post helps, Accept it as a solution
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 |
---|---|
111 | |
94 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |