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.
I have a date table and Financial table.
If I select a particular monthyear from slicer of date table then my visual should display rolling total of previous 12 months sales sum from that selected monthyear.
Eg if I select july 2014, then my visual should display Rolling sum of sales from july 2013 to july 2014. i.e sales of February will be sum of Jan and feb, Sales of March should be sum of Jan,Feb and March and so on.
My code -
How do I do that?
Hi @Anonymous
Try this measure:
rolling total 12 =
VAR _Date =
MAX ( 'Date'[Date] )
VAR _LDate =
DATE ( YEAR ( _Date ) - 1, MONTH ( _Date ), DAY ( _Date ) )
RETURN
CALCULATE (
SUM ( financials[Sales] ),
FILTER ( ALL ( 'Date' ), 'Date'[Date] <= _Date && 'Date'[Date] > _LDate )
)
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
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 |
---|---|
44 | |
25 | |
19 | |
16 | |
8 |
User | Count |
---|---|
61 | |
50 | |
45 | |
20 | |
17 |