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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ann_2024
Helper I
Helper I

Calculate last 6 months sales value using temporary date table

Hey there! I'm diving into DAX and trying to visualize the sales for the last 6 months. I've got this Date_Master table and made a copy named temp_date_master.. The relationship between the Date_Master and Temp_Date_Master was many-to-one. (The video explaining the process ). I have done the following measure

Last_6_Months_Sales = 
var referenceDate = Max('Date Master'[Date])
var referenceDate1 = EOMONTH(referenceDate, -1)
var previousDates = 
    DATESINPERIOD('Temp_Date_Master'[Date],
    referenceDate1 ,
    -6,
    MONTH
    )
VAR Result = 
    CALCULATE(
        [Sales Value],
        REMOVEFILTERS('Date Master'),
        KEEPFILTERS(previousDates),
        USERELATIONSHIP('Date Master'[Date], 'Temp_Date_Master'[Date]))

Return 
    Result

I wanted to convert the relationship between the date_master and temp_date_master to be one-to-many relationship (I am trying it as im losing hierarchy of 'Date Master'[Date] as the column is the "many" side of a model relationship). How to solve this issue?

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@ann_2024 

If you madea copy of  Date_Master and created Temp_Date_Master then the relationship should be one-to one. Not sure why you try to chage it to  one-to-many

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@ann_2024 

If you madea copy of  Date_Master and created Temp_Date_Master then the relationship should be one-to one. Not sure why you try to chage it to  one-to-many

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy Thanks for your suggestion. I have made the relationship one-to-one bidirectional and its working fine. 

Helpful resources

Announcements
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.