cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
baw556
Frequent Visitor

Summing Column on Multiple Category

Hello All,

 

I have this table

engergyCapture.PNG

 

I already have a Tabular Model created to be used in Power BI. I was wondering how to calculated the adjusted consumption using DAX based on its formula shown below the table?

 

Thanks,

 

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @baw556 

Do you want it across all asset types and classes? If so, place tis measure in a card visual:

 

Measure =
VAR Constant_ = 4.3456
RETURN
    CALCULATE ( SUM ( Table1[Consumption] ), Table1[Fuel] = "Electricity" )
        + CALCULATE ( SUM ( Table1[Consumption] ), Table1[Fuel] = "Gas" ) * Constant_

  

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

View solution in original post

3 REPLIES 3
AlB
Super User
Super User

Hi @baw556 

Do you want it across all asset types and classes? If so, place tis measure in a card visual:

 

Measure =
VAR Constant_ = 4.3456
RETURN
    CALCULATE ( SUM ( Table1[Consumption] ), Table1[Fuel] = "Electricity" )
        + CALCULATE ( SUM ( Table1[Consumption] ), Table1[Fuel] = "Gas" ) * Constant_

  

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

baw556
Frequent Visitor

Thanks AIB for your response and I apologize for late reply.

 

Yes, I wanted to aggregate accross asset type and class.

 

When I appplied the formula, it only aggregates the valus for Electricity and doesn't include the secod part of the formula (Gas cons. * constant)

 

Any thoughts?

 

Thanks,

Baw556

baw556
Frequent Visitor

 

The desired result from below should be Adjusted_consumption approx. 203. However, using the formula above, I'm still getting 55.

 

Thanks in advance.

 

engergyCapture2.PNG

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show Episode 10 Recap

The Power BI Community Show

Watch the playback when Amit Chandak, a Power BI Super User, demos how to use Field Parameters to make reports more dynamic.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.

Top Solution Authors
Top Kudoed Authors