Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
alfertab
Helper I
Helper I

Column chart using mesures

Hi everyone, I'm having some troubles with the column chart and I would like to know if someone could help me.

 

I need to plot a column chart like the following:

alfertab_1-1708362528914.png

 

My only problem is that all the results that appears in the chart are measures that were calculated from the columns of a table like the following:

 

DayEnergy Base LoadEnergy Int. LoadEnergy Peak LoadEnergy Base NetEnergy Int NetEnergy Peak LoadBase HourInt. HoursPeak Hours
01/01100013001250150013501006144
02/01105013501200160014001506144

 

The measures are calculated as shown below:

Dprom Load base: CALCULATE(SUM(Energy Base Load)) / CALCULATE(SUM(Base Hour)) = 2050/12 = 170.83

Dprom Load Int: CALCULATE(SUM(Energy Int. Load)) / CALCULATE(SUM(Int. Hours)) = 2650/28 = 94.64

Dprom Load peak: CALCULATE(SUM(Energy Peak Load)) / CALCULATE(SUM(Peak Hours)) = 2450/8 =306.25 

Dprom NET base: CALCULATE(SUM(Energy Base Net)) / CALCULATE(SUM(Base Hour)) = 3100/12 = 258.33

Dprom Net Int: CALCULATE(SUM(Energy Int. Net)) / CALCULATE(SUM(Int. Hours)) =2750/28 =98.21

Dprom Net peak: CALCULATE(SUM(Energy Peak Net)) / CALCULATE(SUM(Peak Hours)) = 250/8 = 31.25

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@alfertab Create two measures, Measure1 and Measure2 similar to the following:

Measure1 = 
  VAR __AxisValue = MAX('Table'[Axis Column])
  VAR __Result =
    SWITCH( __AxisValue,
      "Base", [Dprom Load Base],
      "Intermediate", [Dpom Net Int],
      [Dprom Net Peak]
    )
RETURN
  __Result


Measure2 = 
  VAR __AxisValue = MAX('Table'[Axis Column])
  VAR __Result =
    SWITCH( __AxisValue,
      "Base", [Dprom NET Base],
      "Intermediate", [Dpom Load Int],
      [Dprom Load Peak]
    )
RETURN
  __Result

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-xuxinyi-msft
Community Support
Community Support

Hi @alfertab 

 

Thanks to @Greg_Deckler  for the method, here are my additions:

 

A second table was created.

vxuxinyimsft_0-1708396098409.png

 

Measure:

Dprom Load = 
SWITCH(TRUE(),
SELECTEDVALUE('Table (2)'[a]) = "Base", [Dprom Load base],
SELECTEDVALUE('Table (2)'[a]) = "Intermediate", [Dprom Load Int],
SELECTEDVALUE('Table (2)'[a]) = "Peak", [Dprom Load peak])

 

Dprom Net = 
SWITCH(TRUE(),
SELECTEDVALUE('Table (2)'[a]) = "Base", [Dprom NET base],
SELECTEDVALUE('Table (2)'[a]) = "Intermediate", [Dprom Net Int],
SELECTEDVALUE('Table (2)'[a]) = "Peak", [Dprom Net peak])

 

vxuxinyimsft_2-1708396490732.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
alfertab
Helper I
Helper I

@Greg_Deckler @v-xuxinyi-msft Thanks a lot to both of  you. Personally I used @v-xuxinyi-msft  method (it was a little easier for me to understand) but both worked. 😄

v-xuxinyi-msft
Community Support
Community Support

Hi @alfertab 

 

Thanks to @Greg_Deckler  for the method, here are my additions:

 

A second table was created.

vxuxinyimsft_0-1708396098409.png

 

Measure:

Dprom Load = 
SWITCH(TRUE(),
SELECTEDVALUE('Table (2)'[a]) = "Base", [Dprom Load base],
SELECTEDVALUE('Table (2)'[a]) = "Intermediate", [Dprom Load Int],
SELECTEDVALUE('Table (2)'[a]) = "Peak", [Dprom Load peak])

 

Dprom Net = 
SWITCH(TRUE(),
SELECTEDVALUE('Table (2)'[a]) = "Base", [Dprom NET base],
SELECTEDVALUE('Table (2)'[a]) = "Intermediate", [Dprom Net Int],
SELECTEDVALUE('Table (2)'[a]) = "Peak", [Dprom Net peak])

 

vxuxinyimsft_2-1708396490732.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Super User
Super User

@alfertab Create two measures, Measure1 and Measure2 similar to the following:

Measure1 = 
  VAR __AxisValue = MAX('Table'[Axis Column])
  VAR __Result =
    SWITCH( __AxisValue,
      "Base", [Dprom Load Base],
      "Intermediate", [Dpom Net Int],
      [Dprom Net Peak]
    )
RETURN
  __Result


Measure2 = 
  VAR __AxisValue = MAX('Table'[Axis Column])
  VAR __Result =
    SWITCH( __AxisValue,
      "Base", [Dprom NET Base],
      "Intermediate", [Dpom Load Int],
      [Dprom Load Peak]
    )
RETURN
  __Result

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.