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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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