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

Seven Day Sum with Multiple Filters

Hello,

 

I have a measure that is meant to sum the previous seven days of a filtered table. The measure works well when a single location is selected in a slicer but I am having trouble getting the measure to create a total for the columns when there is more than one location selected. I believe I need to use the sumx function to total the column, but the results I am getting are not correct.  

 

I have prepared a sample file which can be downloaded at this link: https://www.dropbox.com/s/tq405siw51tmt20/Sample%20Multi%20Location.pbix?dl=0

 

The file has two pages, one for the single location measure, which is working correctly and a second that shows the multi-location measure, which is not working correctly.

 

Thank you for your help

 

Thank you for your help. 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

You could try this formula as below:

PaidSevenDaySum Multi Location = var a=MAXX('Labor','Labor'[CalendarDate])
    return Calculate(sum(Labor[DailyLabor]),filter(ALLEXCEPT(Labor,LocationInformation[LocationID]),Labor[Labor_report_description]="Total Paid (D + I)" 
        &&'Labor'[CalendarDate]>a-7
        &&'Labor'[CalendarDate]<=a)
        )
 

Result:

11.JPG

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

You could try this formula as below:

PaidSevenDaySum Multi Location = var a=MAXX('Labor','Labor'[CalendarDate])
    return Calculate(sum(Labor[DailyLabor]),filter(ALLEXCEPT(Labor,LocationInformation[LocationID]),Labor[Labor_report_description]="Total Paid (D + I)" 
        &&'Labor'[CalendarDate]>a-7
        &&'Labor'[CalendarDate]<=a)
        )
 

Result:

11.JPG

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Yes, exactly what I needed. 

 

Thank you!

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.