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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Help with the complex DAX measure

I am struggling with a DAX measure. Here is the fact and 2 dimension tables I have:

 

 

 

 

factAction(dimAccountID, dimActionID, Date, ActionQty)
dimAction(dimActionID, ActionCode, ActionDescription)
dimDate(Date, WorkingDay)

 

 

 

 

The relationships are:

 

 

 

dimDate.Date -> factAction.Date
dimAction.dimActionID->factAction.dimActionID

 

 

 

And I have a DAX measure for ActionQty = SUM('factAction'[ActionQty])

We want to report on the number of actions of ActionCo

de AAA. Fine, that's easy. Just select ActionCode = AAA into the Power BI filter.

But now we want to also report, for those Accounts that had ActionCode AAA, the sum of ActionQty for ActionCode AAB where the ActionDate is within 2 working days of the AAA Action Date.

 

Any suggestions would be welcome!

 

Test data

AccountIDDateActionCodeActionQty
AC16 Apr 2020AAA1
AC19 Apr 2020AAB1
AC17 Apr 2020BBB1
AC216 Apr 2020AAA1
AC220 Apr 2020AAB1

 

Expected results

Filter AccountIDFilter Date (mmm YYYY)New measure expected resultReason
AC1Apr 20200Working days between AAA and AAB is > 2
AC2Apr 20201Working days between AAA and AAB is <= 2
3 REPLIES 3
Anonymous
Not applicable

Please check out the solution carefully.

 

Best

D

Anonymous
Not applicable

Hi. Please post some test data so that we can use it to create a solution. Best would be to have a PBI file but if you can't, then data in textual form will do. No pictures please. You can create tables here using the message's editing tools.

By the way, you've forgotten about the dimAccount table.

Best
D
Anonymous
Not applicable

Test data and expected results added to the original post.

No test data is needed for dimAccount, as nothing from that table is needed - simply the dimAccountID from factAction.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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