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 want to create a bar graph that shows the monthly LTM total of sales. So, for example, a bar for July with sales summed from July 2019-August 2018, a Bar of June with sales summed from June 2019 to July 2018, and so on until whatever time period I choose. Say for example the last bar is September 2017, that bar is the sum of sales from September 2017-October 2016. There is nothing with a cumulative monthly LTM bar graph anywhere, please help!!
Solved! Go to Solution.
Hello @Anonymous
This measure assumes you have a Calendar table linked to your data and a measure that sums sales
R12M Sales = CALCULATE ( [Sales], DATESINPERIOD ( Calendar[Date], MAX ( Calendar[Date] ), -11, MONTH ) )
It will be a seperte table that you have in the model. You can use New Table >
Dates = VAR DateRange = CALENDARAUTO() RETURN ADDCOLUMNS( DateRange, "Year",YEAR ( [Date] ), "Month", FORMAT ( [Date], "mmmm" ), "MonthNum", MONTH ( [Date] ), "Month Year", FORMAT ( [Date], "mmm-yyyy"), "MonthYearNum", YEAR ( [Date] ) * 100 + MONTH ( [Date] ), "Quarter Year", "Q" & FORMAT ( [Date], "q-yyyy" ), "QtrYearNum", YEAR ( [Date] ) * 100 + VALUE ( FORMAT ( [Date], "q" ) ) )
Then link the [Date] column of your data to the Dates[Date] column.
Hello @Anonymous
This measure assumes you have a Calendar table linked to your data and a measure that sums sales
R12M Sales = CALCULATE ( [Sales], DATESINPERIOD ( Calendar[Date], MAX ( Calendar[Date] ), -11, MONTH ) )
It will be a seperte table that you have in the model. You can use New Table >
Dates = VAR DateRange = CALENDARAUTO() RETURN ADDCOLUMNS( DateRange, "Year",YEAR ( [Date] ), "Month", FORMAT ( [Date], "mmmm" ), "MonthNum", MONTH ( [Date] ), "Month Year", FORMAT ( [Date], "mmm-yyyy"), "MonthYearNum", YEAR ( [Date] ) * 100 + MONTH ( [Date] ), "Quarter Year", "Q" & FORMAT ( [Date], "q-yyyy" ), "QtrYearNum", YEAR ( [Date] ) * 100 + VALUE ( FORMAT ( [Date], "q" ) ) )
Then link the [Date] column of your data to the Dates[Date] column.
You are a life saver. Going through your process has helped me learn so much about using dates and filtering. Thank you!
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 |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |