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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
kkashiv
Frequent Visitor

Trying to multiply columns of with different constants

I would like to create a stacked bar chart visualization that takes different values of Commodity( Electric, Natual Gas, Steam, etc). However all the values are in a different unit and I would like multiple specific constant to each column so that they are in the same unit. 



comm_post.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I am able to multiply all columns by a constant by using this DAX expression:
comm_post2.jpg

 In this case, the constanst is 3.

 

However, each of these column is to be multiplied with a different constant to normalize the values.

 

 

Is there a way to achieve this?

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Does this measure work

=if(max(commodities[Commodity])="Electric",[Bill_line_item_values]*3,if(max(commodities[Commodity])="Natural Gas",[Bill_line_item_values]*2,[Bill_line_item_values]*5))

I have assumed that Bill_line_item_values is an explicit measure you have written.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Does this measure work

=if(max(commodities[Commodity])="Electric",[Bill_line_item_values]*3,if(max(commodities[Commodity])="Natural Gas",[Bill_line_item_values]*2,[Bill_line_item_values]*5))

I have assumed that Bill_line_item_values is an explicit measure you have written.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks for your comment. The DAX expression gives out a syntax error.

kkashiv_1-1685514639116.png

So I tried to rectify this but this says that the max function can only accept columns as an argument.

kkashiv_0-1685514594371.png

 

You are welcome.  I did not close the bracket of the Max function.  I have edited my original post.  Please copy and paste the formula again.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

The above DAX worked. Thank you. 

Hi,

I cannot visualise the problem.  Share the download link of the PBI file and show the problem clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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