Forum Discussion

Kuberkumark's avatar
Kuberkumark
Frequent Visitor
4 years ago

Need Help with DAX Formula

Hi Community,

 

I need help with a Power BI Formula.

 

In the below expression there is a seperate value for A and B.

 

I want the expression to show Value of A for Apirl and B for May in the below Matrix under the value of May in the columns

 

Please help

 

 

 

3 Replies

  • v-easonf-msft's avatar
    v-easonf-msft
    Community Support

    Hi, Kuberkumark 

    You can consider using function 'SWITCH'.

    Please try formula like:

    May =
    VAR A =
        CALCULATE (
            DISTINCTCOUNT ( TABLE[xxxx1] ),
            transaction_datails[Month] = "May"
                && transaction_datails[xxx2] = "SaleSuccess"
                && MONTH ( transaction_datails[min_Date] = 4 )
        )
    VAR B =
        CALCULATE (
            DISTINCTCOUNT ( TABLE[xxxx1] ),
            transaction_datails[Month] = "May"
                && transaction_datails[xxx2] = "SaleSuccess"
                && MONTH ( transaction_datails[min_Date] = 5 )
        )
    RETURN
        SWITCH ( MatrixRowfield[Month], "April", A, "May", B )
    

    Best Regards,
    Community Support Team _ Eason