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 August 31st. Request your voucher.

Reply
marcuspaula
Frequent Visitor

Measure Totals in a table visual using Field Parameters

Hello, community!

 

Is there a way to dynamically calculate totals in a table using Field Parameters?

 

I have the following data:

marcuspaula_0-1689884895797.png

 

The following Field Parameter:

 

Parameter - Dimensions = {
    ("Category1", NAMEOF('Table'[Category1]), 0),
    ("Category2", NAMEOF('Table'[Category2]), 1)
}

 

 

And the following measures:

 

.Sum = 
SUM('Table'[Value])-50

 

 

 

.Sum Field Parameter = 
VAR __table = 
    SUMMARIZE(
        'Parameter - Dimensions',
        'Parameter - Dimensions'[Parameter - Dimensions Fields],
        "@row",[.Sum]
    )
RETURN
IF(
    HASONEVALUE('Parameter - Dimensions'[Parameter - Dimensions Fields]),
    [.Sum],
    SUMX(__table,[@row])
)

 

 

And this is the result (3500) I was expecting for my second measure on a Matrix visual:

marcuspaula_0-1689882696732.png

 

And the result I would expect if selecting Category1 (3450):

marcuspaula_1-1689882901293.png

 

PS. if I use the following

 

.Sum Field Parameter := 
SUMX(
    VALUES('Table'[Category1]),
    [.Sum]
)

 

marcuspaula_0-1689980602679.png

 

I have the desired result for the total row (which is the sum of rows). But I would like to dynamically change the column in the SUMX to whatever is selected on the field parameter if possible.

 


@Greg_Deckler 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @marcuspaula,

I'd like to suggest you add switch function to your measure formula to interact with field parameter filter effects and redirect to different calculations:

How to dynamically switch between measures in Power BI visuals with Field Parameters | endjin - Azur...

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @marcuspaula,

I'd like to suggest you add switch function to your measure formula to interact with field parameter filter effects and redirect to different calculations:

How to dynamically switch between measures in Power BI visuals with Field Parameters | endjin - Azur...

Regards,

Xiaoxin Sheng

Hi @Anonymous,

 

I was trying to avoid the SWITCH since I have like 30 different scenarios but it looks like this is the way to get this working. 

 

Thank you.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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