Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Add new column in Matrix visual with up or down arrow (comparison with previous month)

Hello Everyone, Greetings,   i have created below matrix visual with with Year and month in column Region in rows      i have to add new column after each month and which give the compari...
  • Fowmy's avatar
    5 years ago

    Anonymous 

    Hope you have a dates table in your model and it is connected to your fact table. I used the Power BI sample data and created the expected results. The file is attached below my signature. 
    You need to create a measure to evaluate the status and assign it to the CF logic.

    DAX Formula to get the logic: 

    Growth = 
    VAR __SALES = [Total Sales]
    VAR __PM = 
        CALCULATE(
            [Total Sales],
            DATEADD( Dates[Date] , -1 , MONTH )
        )
        RETURN
    IF(
        NOT( ISEMPTY(financials) ) && __PM <> BLANK() && HASONEVALUE(Dates[Year Month No]),
        SWITCH(
            TRUE(),
            __SALES  > __PM ,1,
            __SALES  = __PM, 0,
            __SALES < __PM,-1
        )
    )