Forum Discussion

dilumd's avatar
dilumd
Icon for Impactful Individual rankImpactful Individual
7 years ago
Solved

DAX measure help

Hi experts,

 

I have below data table,

Company

Year

Month

Department

Category

Bud/Act

Overhead

Hours

Complany1

2018

Jul

Dept1

Cat1

Act

50

200

Complany1

2018

Jul

Dept1

Cat3

Act

70

200

Complany1

2018

Jul

Dept1

Cat2

Act

30

200

Complany1

2018

Jul

Dept2

Cat1

Act

40

200

Complany1

2018

Jul

Dept2

Cat3

Act

60

200

Complany1

2018

Jul

Dept1

Cat1

Bud

60

210

Complany1

2018

Jul

Dept1

Cat3

Bud

40

210

Complany1

2018

Jul

Dept1

Cat2

Bud

50

210

Complany1

2018

Jul

Dept2

Cat1

Bud

30

210

Complany1

2018

Jul

Dept2

Cat3

Bud

50

210

Complany1

2018

Aug

Dept1

Cat1

Act

45

190

Complany1

2018

Sep

Dept1

Cat1

Act

60

180

Complany1

2018

Sep

Dept1

Cat1

Act

50

180

Complany1

2018

Sep

Dept1

Cat3

Act

70

180

 

For a table formatted as given I need to have a measure column that calculates Overheads/Hours so that it is dynamic upon selection of the month.

 

For example, for the month of July the calculation is as follows

(50+70+30+40+60)/200 (I got the desired result by using a calculated column of Overhead / Hours) 

 

But when I select 2 or more months together I get the wrong result as the denominator used is wrong. The correct calculation I need as follows if I choose the month September and July

(50+70+30+40+60) + (45+60+50+70) / 200+180

 

Please help.

  • dilumd

     

    Something on this pattern perhaps

     

    Measure =
    SUM ( Table1[Overhead] )
        / SUMX ( VALUES ( Table1[Month] ), CALCULATE ( MIN ( Table1[Hours] ) ) )
    

1 Reply

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

    dilumd

     

    Something on this pattern perhaps

     

    Measure =
    SUM ( Table1[Overhead] )
        / SUMX ( VALUES ( Table1[Month] ), CALCULATE ( MIN ( Table1[Hours] ) ) )