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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Gauge Chart Dynamic Maximum Value

Hi all,

I am trying to create a gauge chart with a dynamic maximum value based on the slicer filters (Category & Query & Date Range) on the dashboard.
I am in the marketing industry and am trying to use the gauge chart to show the maxium [Avg CTR] (click-through-rate) that a query (a search term) has ever gotten in history.

Below in this picture, the Avg CTR in the matrix is a measure that I defined:

mhsieh_4-1654450444581.png

 

 

Sum Clicks = 
IF(
    ISBLANK(
        SUM('GSC query analysis'[Clicks])
    ),
    0,
    SUM('GSC query analysis'[Clicks])
)
Sum Impressions = 
IF(
    ISBLANK(
        SUM('GSC query analysis'[Impressions])
    ),
    0,
    SUM('GSC query analysis'[Impressions])
)
Avg CTR =
IFERROR(
    ('Measure Table'[Sum Clicks]/'Measure Table'[Sum Impressions]),
     0
)

 

 

I want the Max value of the Gauge Chart to show "0.25" in this case.

---

In another case, I can also select multiple queries, it will then calculate the Avg CTR of a month from those selected queries. And then I would want the Max Value of the Gauge Chart to show "0.20".

mhsieh_3-1654450359949.png

I am guessing I will have to use ALLSELECTED to clear the filter in the gauge chart visual but keep the slicer filters, and then get the Avg CTR, then get the Max of the Avg CTR, but I don't know how to do it.

Your help is much appreciated. Many thanks!!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @tamerj1 
I got it to work!! Thank you so so much for helping me out! 

Current CTR (Gauge) = 
CALCULATE(
    [Avg CTR],
    FILTER(
        'GSC query analysis',
        RELATED('Calendar Lookup'[Start of Month]) = MAXX('Calendar Lookup', 'Calendar Lookup'[Start of Month])
    )
)

mhsieh_0-1654551123353.png

 

 

View solution in original post

15 REPLIES 15
tamerj1
Super User
Super User

@Anonymous 

Also please try

 

 

Max CTR =
CALCULATE (
    MAXX (
        CROSSJOIN (
            VALUES ( 'Calendar Lookup'[Start of Month] ),
            SUMMARIZE (
                'GSC query analysis',
                'GSC query analysis'[Category],
                'GSC query analysis'[Query]
            )
        ),
        CALCULATE ( DIVIDE ( [Sum Clicks], [Sum Impressions], 0 ) )
    ),
    REMOVEFILTERS ( 'GSC query analysis' ),
    ALLSELECTED ( 'Calendar Lookup' )
)

 

 
Anonymous
Not applicable

I tried this code, but they all show 1

mhsieh_1-1654544796978.png

mhsieh_2-1654544877553.png

 

tamerj1
Super User
Super User

@Anonymous 

If all columns are in the same table you may try

Avg CTR =
MAXX (
    SUMMARIZE (
        'GSC query analysis',
        'GSC query analysis'[Start of Month],
        'GSC query analysis'[Category],
        'GSC query analysis'[Query]
    ),
    CALCULATE ( DIVIDE ( [Sum Clicks], [Sum Impressions], 0 ) )
)
Anonymous
Not applicable

Since the 'Start of Month' column is from the Calendar Lookup Table, so I changed that line in your code, so it looks below:

 

Max CTR = 
MAXX (
    SUMMARIZE (
        'GSC query analysis',
        'Calendar Lookup'[Start of Month],
        'GSC query analysis'[Category],
        'GSC query analysis'[Query]
    ),
    CALCULATE ( DIVIDE ( [Sum Clicks], [Sum Impressions], 0 ) )
)

 

 This is how it looks like 

mhsieh_0-1654476762573.png

Still not correct..

And if choosing multiple queries, this is how it looks like:

mhsieh_1-1654476826186.png

Not correct either.

@Anonymous 

Please try

Max CTR =
MAXX (
    CROSSJOIN (
        VALUES ( 'Calendar Lookup'[Start of Month] ),
        SUMMARIZE (
            'GSC query analysis',
            'GSC query analysis'[Category],
            'GSC query analysis'[Query]
        )
    ),
    CALCULATE ( DIVIDE ( [Sum Clicks], [Sum Impressions], 0 ) )
)
Anonymous
Not applicable

Hey @tamerj1 

I used your code, but it's giving me the same result, so it's still incorrect.

Single query selected:

mhsieh_0-1654530757241.png

 

Multiple queries selected:

mhsieh_1-1654530903165.png

But I think we are getting there. I think it's still doing the calculatation on the row basis, instead of column as a whole.

@Anonymous 

It allways goves the vslue of the last date. I wonder why!

Would you please activate the row totals and see emwhat is the value shown at the total 

Anonymous
Not applicable

I used this code and turned on the subtotal in the matrix.:

 

Max CTR = 
MAXX (
    CROSSJOIN (
        VALUES ( 'Calendar Lookup'[Start of Month] ),
        SUMMARIZE (
            'GSC query analysis',
            'GSC query analysis'[Category],
            'GSC query analysis'[Query]
        )
    ),
    CALCULATE ( DIVIDE ( [Sum Clicks], [Sum Impressions], 0 ) )
)

 

It seems like if only selecting one query, the total of the Max CTR would show the correct value that I want!
ex1: 

mhsieh_5-1654540147073.png

ex2: 

mhsieh_7-1654544323877.png

However, if selecting multiple queries. The total of Max CTR will show only the biggest max ctr out of all the individual queries (0.25), instead of collectively "Sum Clicks of all queries / Sum Impressions of all queries" which shuold be 0.07 in this case.

mhsieh_6-1654544293685.png

@Anonymous 

Ok. Can we try more simple

Max CTR =
MAXX ( ALLSELECTED ( 'Calendar Lookup'[Start of Month] ), [Avg CTR] )
Anonymous
Not applicable

I actually have tried this line of code before. It showed correctly in the matrix, but incorrect in the gauge chart.

mhsieh_0-1654546047580.png

mhsieh_1-1654546087018.png

 

@Anonymous 

For some reason, no matter what we do ot only shows the value of the last date! 

Anonymous
Not applicable

Now you mentioned that it always show the last date, I realized it is because I set the visual filter to be "Start of Month" - "Top 1" - "Latest Start of Month" so that I can show the current CTR (0.07), but then it will cause the Max CTR to not work. 

mhsieh_0-1654548065193.png

If I clear that fitler, the Max CTR will be correct! but then the current CTR will be incorrect.

mhsieh_1-1654548234136.png

That being said, we can tackle it from a different direction, trying to create a new measure to get the current CTR for the gauge chart. Do you know how I can write the code to get the current CTR for the gauge chart?


Anonymous
Not applicable

Hi @tamerj1 
I got it to work!! Thank you so so much for helping me out! 

Current CTR (Gauge) = 
CALCULATE(
    [Avg CTR],
    FILTER(
        'GSC query analysis',
        RELATED('Calendar Lookup'[Start of Month]) = MAXX('Calendar Lookup', 'Calendar Lookup'[Start of Month])
    )
)

mhsieh_0-1654551123353.png

 

 

tamerj1
Super User
Super User

Hi @Anonymous 

is everything in one table?

Anonymous
Not applicable

Hi @tamerj1 

I have 2 tables:

1 - Calendar Lookup Table

mhsieh_0-1654471115394.png

 

2 - GSC query analysis Table

mhsieh_1-1654471162512.png

And they are connected by the Date Column

mhsieh_2-1654471245428.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors