cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AbdulAzad
Frequent Visitor

How to get calculated measure by category on a single fact with multiple-relationship on date column

Hi,

 

We have single fact table with join on two different dates and there are multiple measures aggregated based on these two different dates. Time table is joined with Demand fact table on NeedDate and SchedDate. I have imported the data and did the modeling, where requirement for one of the measure is to get the MAX of QTY by ORDER ID column. Here the challenge is how can I make sure the QTY and the ORDER ID columns to use the NeedDate relationship before performing the MAX of QTY by ORDER ID?

 

USERRELATIONSHIP function require CALCULATE function in order to get the relationship to work, not sure how can we bring the relationship join for ORDER ID?

 

MAX of QTY by ORDER ID DAX calculated measure calculation I have as shown below?

sumx(values(Table[ORDER ID]), calculate(max(Demand[QTY])))

 

But I need to get the ORDER ID and QTY based on NeedDate join. How can I achieve this?

 

Can we get this done using DAX?

 

Thanks & Regards,

Abdul

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@AbdulAzad , Assume SchedDate is inactive

sumx(values(Table[ORDER ID]), calculate(max(Demand[QTY]), USERRELATIONSHIP (Date[date],Demand[SchedDate] )))

 

also refer

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@AbdulAzad , Assume SchedDate is inactive

sumx(values(Table[ORDER ID]), calculate(max(Demand[QTY]), USERRELATIONSHIP (Date[date],Demand[SchedDate] )))

 

also refer

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!

Hi Amit,

 

Thank you for your quick and awesome reply. You mean to say the calculate part in sumx function if it refers to a specific table join then the corresponding ORDER ID values also will be picked from calculate part join.

 

Thanks & Regards,

Abdul

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

Power BI Dev Camp Session 22 with aka link 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!