Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hey,
I've been given an assignment that I completely don't know how to do correctly. I'm supposed to create a table that shows the last 12 months of sales ratio. The sales ratio is calculated as current sales to sales one year back.
With the date table connected to the data model, I calculated this as CALCULATE(SUM(Table[value]), SAMEPERIODLASTYEAR(DIM_DATE[Date])). However, in case I want to always show the last 12 months, then I have to create an additional table with dates and from it select the periods to visualize and based on that calculate the sales indicator, which completely doesn't work for me. Sameperiodlastyear doesn't work with disconnected table.
For example, for 2024'08 it's 300M, for 2023'08 it's 380M, so how to calculate with disconnect table?
Solved! Go to Solution.
YearMo | DateKey | Sales in millions |
01.01.2023 | 20230101 | 100 |
01.02.2023 | 20230201 | 300 |
01.03.2023 | 20230301 | 340 |
01.04.2023 | 20230401 | 389 |
01.05.2023 | 20230501 | 200 |
01.06.2023 | 20230601 | 400 |
01.07.2023 | 20230701 | 204 |
01.08.2023 | 20230801 | 209 |
01.09.2023 | 20230901 | 207 |
01.10.2023 | 20231001 | 390 |
01.11.2023 | 20231101 | 270 |
01.12.2023 | 20231201 | 310 |
01.01.2024 | 20240101 | 370 |
01.02.2024 | 20240201 | 380 |
01.03.2024 | 20240301 | 390 |
01.04.2024 | 20240401 | 200 |
01.05.2024 | 20240501 | 310 |
01.06.2024 | 20240601 | 370 |
01.07.2024 | 20240701 | 280 |
01.08.2024 | 20240801 | 390 |
01.09.2024 | 20240901 | 240 |
I've calendar table which is connect by DateKey with FactTable as follows.
I wanna get a table visual, where I'll have Last 12 months dynamically. So for example, if i will choose data from 2024-09 in my calendar table, then I wanna see data from 2023-09 to 2024-09. In addition I wanna get sales ratio as comparison sales in 2024 to sales in 2023. For example for 2024-09 it's 240M and for 2023-09 it's 207M, so ratio should be 240/209.
Thanks in advance
And sorry for data formatting, It gets me a lot of errors if I wanna copy data from my excel.
yeah, you should not need a disconnected table in that scenario. You do need a calendar table though (which you seem to have).
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
23 | |
21 | |
20 | |
13 | |
12 |
User | Count |
---|---|
43 | |
31 | |
24 | |
23 | |
22 |