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 all,
I have an issue with the Rolling total from last year vs this year. I need to create a measure that calculates the following:
YTD Shipments / (LastYear(YTD shipments)/LastYear(Shipments)
This is being of an issue, mainly because the date of the data is the first Monday of each week, that means I have data from week to week. That is messing up when I use Dateadd functions.
The YearToDate calculations are working fine the problem is last year running total. The important thing is no just the total index (formula above) but that it can be display and filter in a table or other visuals.
Here is what I have done so far:
ShipmentsLYTD = IF ( HASONEVALUE ( 'TableShipments'[Time] ), CALCULATE ( SUM ( 'TableShipment'[Shipments] ), SAMEPERIODLASTYEAR ( 'TableShipment'[Time] ) ), SUMX ( SUMMARIZE ( 'TableShipment', 'TableShipment'[Time], 'TableShipment'[Country], "LYTD", CALCULATE ( SUM ( 'TableShipment'[Shipments] ), SAMEPERIODLASTYEAR ( DATESYTD ( 'TableShipment'[Time] ) ) ) ), [LYTD] ) )
For the Last Year calculation I have:
TransLY = IF(HASONEVALUE('TableShipments'[Time]), CALCULATE( SUM('TableShipments'[Shipments]), PREVIOUSYEAR('TableShipments'[Time]) ), CALCULATE( SUM('TableShipments'[Shipments]), 'TableShipments'[LY] = TRUE() ) )
(updated) The LY calculation is like this:
LY = If(YEAR('TableShipments'[Time]) = YEAR(MAX('TableShipments'[Time]))-1,TRUE())
What I expect is something like the index in the last part of the screenshot.
The data is something like this
Thanks in advance.
FYI: @thschr
@Jmenas ,
YTD Shipments / (LastYear(YTD shipments)/LastYear(Shipments)
Could you explain more about the three columns/measures above? In addtion, in the Last Year calculation you provided, you use
'TableShipments'[LY] = TRUE()
But where is the column [LY] in the sample data? Could you also share the expected result for further analysis?
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-yuta-msft ,
Thanks, I updated the task with what you mentioned.
Let me know you need more info.
Best,
J.
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 |
---|---|
105 | |
105 | |
88 | |
73 | |
66 |
User | Count |
---|---|
124 | |
113 | |
98 | |
81 | |
72 |