Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Difference Calculation Error based on Dates (month)

Hi Experts

See Sample Data - I am trying to work out the diference month on month starting at M0 

So M0 = 202, M1 = M0-M1 and M2 = M1-M2 and so on

 

My Dax Measures are

1. Paydown = [Value]*[Percentage] (where i am getting the Max for the value and Percentage column)

 

2. Balance Paydown = 
VAR _prevdate = Lastnonblank(
Filter(All('Input'[M Column]), 'Input'[M Column]>= SelectedValue('Input'[M Column])
),
[Paydown])

Return

Calculate([Paydown],'Input'[M Column]<=_prevdate)

 

Then a New Measure

Bal = if([Maxcolumn] = "M0", [Paydown], [Balance Paydown]-[Paydown])

 

Total lost 

M ColumnValuePercentageMonth
M0                202.0100%01/02/2021
M1                191.995%01/03/2021
M2                172.790%01/04/2021
M3                146.885%01/05/2021
M4                117.480%01/06/2021
M5                  88.175%01/07/2021
M6                  61.770%01/08/2021
M7                  40.165%01/09/2021
M8                  24.060%01/10/2021
M9                  13.255%01/11/2021
M10                    6.650%01/12/2021
M11                    3.045%01/01/2022
M12                    1.240%01/02/2022
M13                    0.435%01/03/2022
M14                    0.130%01/04/2022
M15                    0.025%01/05/2022
M16                    0.020%01/06/2022
M17                    0.015%01/07/2022
M18                    0.010%01/08/2022
M19                    0.05%01/09/2022
M20                       -  0%01/10/2022

8 Replies

  • Anonymous , Can you share the expected output in the table. You can get a new column getting the last row value earlier.

    • Anonymous's avatar
      Anonymous
      Not applicable

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , Try a new column

        new column =
        var _1 = maxx(filter(table, [month] <earlier([month])), [month])
        return
        Table[value] - maxX( filter(Table, [month] =_1),Table[value])+0

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Amit 

       

      I need this as a measure not a new column....the FACT table is more tricky then what i have shown