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
mcinnisbr
Advocate I
Advocate I

switching slicer context based on calculated column logic

If this is possible, I have no idea, though i'm guessing I can't do this via calc column.  Seeking expert opinions.   
I have a table consisting of a company that can exist in multiple regions.  (Company A is the only instance)

mcinnisbr_1-1676997048111.png

 

I have 2 calculated columns within the table that identifies the status & summary of the funding for each company.  For each, i'm essentially summing the overall status and/or summary for the unique 6 companies, instead of a granular view by region.


Status Calc column

mcinnisbr_0-1676997377890.png


Summary Calc column

mcinnisbr_3-1676997109953.png

Now, this works well on my visual slicer for the overall status/summary for each company.  However, what if i wanted to include the regional filter to show the more granular breakdown?  Currently, because my column logic only sums at the highest level (all except company) if i filtered by region, the logic would be incorrect for those companies that exist in others regions. 

So, is there a way to write a selected column slicer switch of some kind to say something like:
if you select the region column, then switch the context in the calculated column, which would filter everything except for company and region (therefore enabling the correct status/summary at the regional level) :

var Total_Fiscal_Allocation = CALCULATE([SUMfiscal],ALLEXCEPT(Sheet1,Sheet1[Company],Sheet1[Region]))
var Total_Notional_Allocation = CALCULATE([SUMallocation],ALLEXCEPT(Sheet1,Sheet1[Company],Sheet1[Region]))
 
if not, revert back to the logic with the overall filter context staying at the company level only:
var Total_Fiscal_Allocation = CALCULATE([SUMfiscal],ALLEXCEPT(Sheet1,Sheet1[Company]))
var Total_Notional_Allocation = CALCULATE([SUMallocation],ALLEXCEPT(Sheet1,Sheet1[Company]))


So, you can see from my visual, if I filter by a company that has multiple regions, i receive the incorrect status and summary logic.  obviously this I because i'm asking the logic to give me the overalls for each company.  Though, can I switch the logic to enable granularity in my filter context and switch back depending pn the slicer choice?  Thanks.  Can expand if need be.  

mcinnisbr_0-1676997028958.png

 

 

 

2 REPLIES 2
mcinnisbr
Advocate I
Advocate I

Sorry fo the late reply, and thanks.  I think I understand your binning suggestions.  Though, not quite solving.  For sure, instead of using the calculated column (which i did initially for the binning), I can just use a measure to dynamincally determine the status for each aggregate 'company' value.  However, I can't get my head around getting the correct sum value for these status bins in a separate table.   I'm not sure if my logic can create bins the same way you discribe within a parameter slicer.  Though, ulitmately, my goal is to get the correct total for the aggregate total of increases/decreases in a visual and use a parameter slicer to filter the larger company table... (TBH, i'm not sure if that is possible based on my data)

Ultimately, the poroblem is that there are mulitple row contexts for each company, I want a table count and slicer to ignore the row context and provide a count for each company based on overall status (dictated by my meaaure).  I don't want the count for each row instance of an increase or decreased of that same company.  

example below....this is the Dynamic measure table view that gives me correct aggregate values.  It states the correct overall context of the companies. that's good.  The question is, how do I ignore the row context, and show the correct aggregate status values outside of this table view? 


mcinnisbr_0-1677591677619.png

Can i dynamincally create a table like this that ignores row context of my data?  can i slice other visuals by these categories?

 

6 companies, and their aggregate status breakdown is this:

------ 

2 - decrease

1 - increase

1 - no funding change

2 - 0 both years

-----

 

------raw data

mcinnisbr_1-1677592482456.png

 

 

amitchandak
Super User
Super User

@mcinnisbr , I think you need dynamic Segmentation here

 

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

 

Customer Retention with Dynamic Segmentation, New/Lost/Retain Customer Count: https://youtu.be/EyL7KMw877Q

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.

Top Solution Authors