Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get 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

Reply
Asmoday1507
Frequent Visitor

Sales Value Previous year from disconnect table

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?

 

 

1 ACCEPTED SOLUTION

You can use quick measures for that

 

lbendlin_0-1728339342647.pnglbendlin_1-1728339451848.png

 

View solution in original post

3 REPLIES 3
Asmoday1507
Frequent Visitor

YearMoDateKeySales in millions
01.01.202320230101100
01.02.202320230201300
01.03.202320230301340
01.04.202320230401389
01.05.202320230501200
01.06.202320230601400
01.07.202320230701204
01.08.202320230801209
01.09.202320230901207
01.10.202320231001390
01.11.202320231101270
01.12.202320231201310
01.01.202420240101370
01.02.202420240201380
01.03.202420240301390
01.04.202420240401200
01.05.202420240501310
01.06.202420240601370
01.07.202420240701280
01.08.202420240801390
01.09.202420240901240

 

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. 

You can use quick measures for that

 

lbendlin_0-1728339342647.pnglbendlin_1-1728339451848.png

 

lbendlin
Super User
Super User

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.


 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.