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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.