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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jimboslice
Frequent Visitor

Percentage Month over Month for Dynamic Visual using Field Parameters

Hello,

 

I'm trying to create a dynamic visual that will allow me to show total count and percentantage of monthly total per subset per month, with both "percent or grand total" and the specific subset being selectable using a field parameter. It all works fine for total counts, but I'm having trouble calculating the percentage and getting the denominator to reference only the monthly total and not the grand total.

 

I can get it to work through brute forcing using selectedvalue() and a switch statement for the denominator where it calculates the countrows with different removefilter() statements depending on which field parameter value is selected (below), but that feels very clunky and also difficult to upkeep if the end users end up wanting more fields added to the list of allowable legends.

 

I've also tried using allexcept(), but then it ends up not functioning properly if it's being filtered by anything else on the page. The x axis is a date hierarchy on a date field on the same table.

Any advice would be greatly appreciated!

 

 

Percent of Quotes = 
var field = SELECTEDVALUE(Legend[Legend Fields])
var fieldname = switch(true(),
CONTAINSSTRING(field,"Subset1"),"Subset1",
CONTAINSSTRING(field,"Subset2"),"Subset2",
CONTAINSSTRING(field,"Subset3"),"Subset3",
CONTAINSSTRING(field,"Subset4"),"Subset4")

var num =
countrows('Table')

var denom = 
switch(fieldname,
"Subset1",
CALCULATE(
    countrows(
        'Table'),
        REMOVEFILTERS(
            'Table'[Subset1]
        )
),
"Subset2",
CALCULATE(
    countrows(
        'Table'),
        REMOVEFILTERS(
            'Table'[Subset2]
        )
),
"Subset3",
CALCULATE(
    countrows(
        'Table'),
        REMOVEFILTERS(
            'Table'[Subset3]
        )
),
"Subset4",
CALCULATE(
    countrows(
        'Table'),
        REMOVEFILTERS(
            'Table'[Subset4]
        )
)
)
return divide(num,denom,0)

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi @jimboslice ,

Any update on this? Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

HI @jimboslice,

Perhaps you can take a look the following document about field parameter if it suitable for your requirement:

Use report readers to change visuals (preview) - Power BI | Microsoft Learn

Regards,

Xiaoxin Sheng

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