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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
AriBnK
Regular Visitor

How to get previous month data with ID to ID relationship

Hello everyone,

 

I have two tables :

- DIM_Period which is a date table, containing [ID_Period] (integer), [Period] (text) and [Date] (date)

- FACT_Table wich is the tbale where my values are stored, containing [ID_Period] (integer) and [Value] (integer)

 

I am trying to display in a visual the sum of value for current month and for previous month for a selected period, like this :

AriBnK_0-1705912286133.png

But in order to reduce report size, I mapped the DIM_Period table to my FACT_Table with IDs of integer type (because integer type is less size consuming than date type).

So my relationship looks like this :

AriBnK_1-1705912569243.png

And here is my problem : I can't find a way to use PREVIOUSMONTH or DATEADD correctly with that case.
I created a mesaure like this :

PreviousMonth = CALCULATE(SUM(FACT_Table[Value]), PREVIOUSMONTH(DIM_Period[Date]))
 
But the result of the measure was blank in the table :
AriBnK_2-1705913678873.png

Does someone can help me with that problem ?

 

I would like to continue mapping the DIM & FACT tables with ID relationship

 

Thank you

1 ACCEPTED SOLUTION
speedramps
Super User
Super User

It is best practice to use calendar "offsets"

Learn about "offsets" here Click here for Offset tutorial video 

 

Thanks for the clear description of the problem with example data. I wish everyone did that!

Remember we are unpaid volunteers, and you have got free expert help which took a lot of effort,
This solution works and does exactly what you asked.
So please quickly click the [accept as solution] and the thumbs up button to leave kudos. 

One question per ticket please. If you need to change or extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

If you quote @speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

Please now click the [accept as solution] and the thumbs up button.  Thank you.

View solution in original post

1 REPLY 1
speedramps
Super User
Super User

It is best practice to use calendar "offsets"

Learn about "offsets" here Click here for Offset tutorial video 

 

Thanks for the clear description of the problem with example data. I wish everyone did that!

Remember we are unpaid volunteers, and you have got free expert help which took a lot of effort,
This solution works and does exactly what you asked.
So please quickly click the [accept as solution] and the thumbs up button to leave kudos. 

One question per ticket please. If you need to change or extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

If you quote @speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

Please now click the [accept as solution] and the thumbs up button.  Thank you.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors