recharge amount
recharge amount

Reputation: 1

Power Bi : YTD vlues needed

i have columns " month", "year", "totmhr", "msjob_type" in a data table.

Need dax code where msjob_typ is "DEF" for sum of "totmhr" with condition when "MONTH" is 4, need values of Totmhr for 4th month, when "MONTH" IS 5, need values of Totmhr for 4th + 5th month, when "MONTH" IS 6, need values of Totmhr for 4th + 5th+6th month and so on .

CoINP_YEAR  INP_MONTH   MISJOB_TYPE TOTMHR
2,023   4   DEF 160
2,023   4   OH  144
2,023   4   DEF 50
2,023   4   DEF 80
2,023   4   OH  155
2,023   4   DEF 0
2,023   4   DEF 160
2,023   4   DEF 160
2,023   5   DEF 160
2,023   5   DEF 160
2,023   5   DEF 160
2,023   5   OH  16
2,023   5   DEF 160
2,023   6   DEF 0
2,023   6   DEF 40
2,023   6   OH  155
2,023   6   DEF 0
2,023   6   DEF 160
2,023   6   OH  160
2,023   6   OH      160
2,023   6   DEF 160
2,023   6   DEF 160
2,023   6   OH  16
2,023   6   DEF 160
----------
2,024   1   OH      160
2,024   1   DEF 160
2,024   2   DEF 160
2,024   2   OH  16
2,024   3   DEF 160

Upvotes: 0

Views: 21

Answers (1)

Ryan
Ryan

Reputation: 2480

you can try this

sum =
SUMX (
    FILTER (
        all('Table (3))',
        'Table (3)'[CoINP_YEAR] = MAX ( 'Table (3)'[CoINP_YEAR] )
            && 'Table (3)'[INP_MONTH] <= MAX ( 'Table (3)'[INP_MONTH] )
    ),
    'Table (3)'[TOTMHR]
)

screenshot of output

Upvotes: 0

Related Questions