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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Ruz
Regular Visitor

Create a variable chart that calculates ratios and plots the chart

Hi,

 

I am trying to create a variable chart where it will show the ratio of Column "A" and Column "B". Except i need A and B to be variable selected from 15 columns, is that possible?

 

i.e. I have weekly values of 15 different products and I want to create a chart where I would select my numerator and denominator using slicer and plot the ratio based on time.

 

Thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Ruz ,

Here is my sample data:

vjunyantmsft_0-1705975585122.png

And I build two table to create two slicers for numerator and denominator:

vjunyantmsft_1-1705975634161.png
vjunyantmsft_2-1705975640646.png

vjunyantmsft_3-1705975920724.png


Use this DAX to create a new measure:

Measure = 
VAR Numerator_SUM = 
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        'Table',
        'Table'[Column] = SELECTEDVALUE('numerator'[numerator])
    )
)
VAR Denominator_SUM = 
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        'Table',
        'Table'[Column] = SELECTEDVALUE('denominator'[denominator])
    )
)
RETURN
DIVIDE(Numerator_SUM, Denominator_SUM)

Put this measure into the visual, and the final output is below:

vjunyantmsft_4-1705976003702.png

 

Best Regards,
Dino Tao
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

4 REPLIES 4
Anonymous
Not applicable

Hi @Ruz ,

Here is my sample data:

vjunyantmsft_0-1705975585122.png

And I build two table to create two slicers for numerator and denominator:

vjunyantmsft_1-1705975634161.png
vjunyantmsft_2-1705975640646.png

vjunyantmsft_3-1705975920724.png


Use this DAX to create a new measure:

Measure = 
VAR Numerator_SUM = 
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        'Table',
        'Table'[Column] = SELECTEDVALUE('numerator'[numerator])
    )
)
VAR Denominator_SUM = 
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        'Table',
        'Table'[Column] = SELECTEDVALUE('denominator'[denominator])
    )
)
RETURN
DIVIDE(Numerator_SUM, Denominator_SUM)

Put this measure into the visual, and the final output is below:

vjunyantmsft_4-1705976003702.png

 

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

Hi Dino @Anonymous 

 

I am trying to explore bringing this 1 step further, what I mean is that in this case I want to create same type of variable chart but I only select the numerator and formula would generate chart with all denominator options.

 

i.e. I select numerator A from slicer and formula calculates and plots A/B, A/C, A/D.

 

Appreciate your expertise and help.

 

Thank you!

Hi Dino,

 

This works perfectly as what I needed, thank you!

Daniel29195
Super User
Super User

Hello @Ruz 

 

if you could please share a visual representation of the data and the desired output.

 

 

best regards,

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.