Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

DAX-help.

Hi,

 

Require help in acheving the below count of reference number, sample data set shared below.

Similar to below syntax in DAX.

if (Month=Jan, logic=0,1,2 Result[Count of Reference Numbers that are in(Logic 0,1,2)]
            elseif Month=Feb,Logic=3,6,7 Result[Count of Reference Numbers that are in(Logic 5,6,7)]
           elseif Month=March,Logic=5,8,9 Result[Count of Reference Numbers that are in(Logic 5,6,7)]
             .......
    ),Blank())

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Regards,

Sam

  • Hi Anonymous ,

     

    Here we go!

    Column = 
    VAR from1_2 =
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                'Table',
                'Table'[Logic] IN { 0, 1, 2 }
                    && 'Table'[Year] = EARLIER ( 'Table'[Year] )
            )
        )
    VAR from3_7 =
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                'Table',
                'Table'[Logic] IN { 3, 6, 7 }
                    && 'Table'[Year] = EARLIER ( 'Table'[Year] )
            )
        )
    VAR from5_9 =
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                'Table',
                'Table'[Logic] IN { 5, 8, 9 }
                    && 'Table'[Year] = EARLIER ( 'Table'[Year] )
            )
        )
    RETURN
        SWITCH (
            TRUE (),
            'Table'[Month] = "Jan"
                && 'Table'[Logic] IN { 0, 1, 2 }, from1_2,
            'Table'[Month] = "Feb"
                && 'Table'[Logic] IN { 3, 6, 7 }, from3_7,
            'Table'[Month] = "Mar"
                && 'Table'[Logic] IN { 5, 8, 9 }, from5_9
        )
    

     

5 Replies