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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dengydongn
Employee
Employee

Compare all other cells in one column against one selectcell from same column (same column division)

Hello all,

 

I have a trivial question regarding same column division, say I'm running A/B testing, with below observations,

 

What I need is to show how much improvements each of my change has against the base (control), 

 

flight idperformance
flight10.5%
flight20.4%
control0.3%
flight30.6%

 

Keep in mind here flight1, flight2, or control would be any string, there could be more flight4, flight5, etc. order in the table is unfixed, so I cannot access "control" by index but only by name. So I need to access [flight id]{"control"} this cell specifically as the base unit then do all the calcuation, not sure how to even start...

 

Eventually I'll need this, here 66% is from 0.5% / 0.3% and so on

 

flight166%
flight233%
flight3100%

 

So my question is, how do I do this in Power BI desktop, I wouldn't mind building a 2nd table first then draw a simple chart based on it, or write DAX for measurement, whichever is easier.

 

Thanks!!!

2 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@dengydongn add these measure and should be good to go:

 

Base Performance = SUM ( Flight[performance] )

Control Performance = CALCULATE ( [Base Performance], Flight[flight id] = "Control" )

Flight Performance against control = DIVIDE ( [Base Performance], [Control Performance] ) - 1

 

use last measure in your visual and you can filter the visual to not to show the control

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

CNENFRNL
Community Champion
Community Champion

Derived table,

COMPARISON = 
VAR __c =
    SUMX( FILTER( FLIGHT, FLIGHT[flight id] = "control" ), FLIGHT[performance] )
RETURN
    SELECTCOLUMNS(
        FILTER( FLIGHT, NOT FLIGHT[flight id] = "control" ),
        "Fligt ID", FLIGHT[flight id],
        "Comparison", DIVIDE( FLIGHT[performance], __c ) - 1
    )

Screenshot 2021-06-24 010511.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@dengydongn yes that's exactly what it is doing. 

 

The solution @CNENFRNL  provided is great but in a larger schema of things I will avoid creating a calculated table and the big reason is if you are slicing and dicing the data, these percentages will not be dynamic but it all depends on the use case. cheers!!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

CNENFRNL
Community Champion
Community Champion

Derived table,

COMPARISON = 
VAR __c =
    SUMX( FILTER( FLIGHT, FLIGHT[flight id] = "control" ), FLIGHT[performance] )
RETURN
    SELECTCOLUMNS(
        FILTER( FLIGHT, NOT FLIGHT[flight id] = "control" ),
        "Fligt ID", FLIGHT[flight id],
        "Comparison", DIVIDE( FLIGHT[performance], __c ) - 1
    )

Screenshot 2021-06-24 010511.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

parry2k
Super User
Super User

@dengydongn add these measure and should be good to go:

 

Base Performance = SUM ( Flight[performance] )

Control Performance = CALCULATE ( [Base Performance], Flight[flight id] = "Control" )

Flight Performance against control = DIVIDE ( [Base Performance], [Control Performance] ) - 1

 

use last measure in your visual and you can filter the visual to not to show the control

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks, this solved my problem like a charm, if I understand this correctly, first measure basically copies the perf column, 2nd mesaure copies the control perf and apply to all columns, 3rd measure does a division on base / control, is that correct? the function SUM was a bit confusing as I thought it would sum all values in the same column but turned out it merely copied the column

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.