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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.