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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
CMOLINA
Frequent Visitor

Calculate Value to GAP Price

Hi team, I need your help to calculate "GAP PRICE", this is divide the Price Value of one column value between the another value from same column 

  • A column has 2 values: "Company 1" and "Company 2" 
  • Each Product has an Unit Price in each Company
  • GAP_Price Product 1 = Unit Price (product 1 in Company 1) / Unit Price (product 1 in Company 2) 

CMOLINA_0-1729212823769.png

 

1 ACCEPTED SOLUTION

Hi All

 

this is the solution I found:

 

CMOLINA_0-1729479660229.png

 

thanks for your help

 

View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

Hi @CMOLINA ,

 

This can be calculated forcing the filter context of the company level, my question is only if company 1 and company 2 are always the same or if they can change.

 

You can try something similar to this:

Price GAP = DIVIDE( SUM(Table[UnitPrice]), CALCULATE(SUM(Table[UnitPrice]), Table[Company] = "Company2"))

 

Be aware that as you can see I'm forcing the filter on the second one to be Company 2 so not dinamic and in the second column you highlight this would give 100% since you would be divinding the number by itself, but is possible to make it dinamic but you need to tell me how you want to have the companies selection.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix thanks for your answer

1. The name is always the same 🙂

2. I tried your suggestion but the value in column "Company 1" doesn't show 

CMOLINA_0-1729272556936.png

 

Hi ALL,
Firstly  MFelix thank you for your solution!
And @CMOLINA ,When running in our example data, we can see that company1 can have a value in this place.

vxingshenmsft_0-1729475715092.png

If your Column 1 is not displaying normal values, it is possible that the metric is not displaying the values correctly under Company 1, as in my example below, which could cause an error in your Column 1.

vxingshenmsft_1-1729476011010.png

Maybe I can't fully reproduce your problem due to my example data is too simple, may need to provide some example data or pbix file, we can better help you to solve this problem, if you still have further questions, you can contact us at any time, we will be the first time to reply to you after we receive your message, looking forward to your reply!

Hope it helps!

Best regards,
Community Support Team_ Tom Shen

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

 

 

 

Hi All

 

this is the solution I found:

 

CMOLINA_0-1729479660229.png

 

thanks for your help

 

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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