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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Jk29297
Regular Visitor

Switch() function not working for all categories

I am using a switch function to display data in a certain order and tag certain values to measures.  however, the result does not display the first and last category.  Here is the DAX

Report Value = (IF (AND (MAX ( Main[Is sum])=2,[Filtered]),
    BLANK (), SWITCH(MIN(Main[Is sum]),
               1, [OpeningBalance],
               2, (CALCULATE(SUM(Data[Debit/Credit Amount])),
               3,(CALCULATE(SUM(Data[Debit/Credit Amount])),
               4,[ClosingBalance]
               )))

________________________________________________________________________________

Filtered = ISFILTERED(Submapping[Sub_grouping])
 
result is
Jk29297_0-1682091962816.png

Opening balance and Closing balance are not shown.  Each category is defined in the Main table and mapped to same numbers in Is Sum column.  The total appearing as row subtotal is on.

 

any guidance is appreciated.

2 REPLIES 2
Jk29297
Regular Visitor

Adding further information, the relationship of tables are:  

Jk29297_0-1682175463298.png

further, the table Main has the following columns and data:

Jk29297_1-1682175525368.png

The table matrix output filters are :

Jk29297_2-1682175633260.png

 

Wilson_
Super User
Super User

Hello Jk,

 

Please help us help you.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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