Forum Discussion

Jk29297's avatar
Jk29297
Regular Visitor
3 years ago

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

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