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

Dynamically Sum Columns based on Slicer

Alright, I have several columns:

 

Location

Approved Budget

SD Budget

SF Budget

LA Budget

OC Budget

IE Budget

BFD Budget

 

Approved Budget should be a meausre that sums sd, sf, la, oc, ie, and bfd budget. I'd like to be able to slice Approved Budget by location, so that if IE is chosen as a location, only rows with >0 entries in IE Budget would sho win the table or visual.

 

Here's where I am getting lost, my location field is a comma seperated text field from my database. Pissble entires include:

 

SD

SF

LA

OC

IE

BFD

SD,LA,IE

SD,SF

All

 

I don't even know if it is wise to use the location column at all in this case, but I need the core values to control whatever slicer I have set up.  

 

TLDR, what I'm saying is probably confusing, so what I'm looking for is how to sum my budget columns based on what locations I select.

 

Test Data Link:

 

https://drive.google.com/file/d/1YlfOmeoPFQHI6DTIQjSIwvT7nTzL1bYC/view?usp=sharing
https://drive.google.com/file/d/1kdchVQXMzVPXoF-pTWsvsw9C9D3S1mql/view?usp=sharing

 

This is the DAX for Approved Budget. I'm sure someone could point out a simpler way to do this if they wanted to:

 

"

Approved Budget = sumx(Sheet1,if(iferror(search("SD",Sheet1[Location]),0)>0,Sheet1[SD Budget],0)+if(iferror(search("SF",Sheet1[Location]),0)>0,Sheet1[SF Budget],0)+if(iferror(search("LA",Sheet1[Location]),0)>0,Sheet1[LA Budget],0)+if(iferror(search("OC",Sheet1[Location]),0)>0,Sheet1[OC Budget],0)+if(iferror(search("IE",Sheet1[Location]),0)>0,Sheet1[IE Budget],0)+if(iferror(search("BFD",Sheet1[Location]),0)>0,Sheet1[BFD Budget],0)+if(iferror(search("ALL",Sheet1[Location]),0)>0,Sheet1[SF Budget]+Sheet1[SD Budget]+Sheet1[LA Budget]+Sheet1[OC Budget]+Sheet1[IE Budget]+Sheet1[BFD Budget],0))"

 

 

data sample.PNG

17 REPLIES 17

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.