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
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...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.