Forum Discussion

marcuspaula's avatar
marcuspaula
Frequent Visitor
3 years ago
Solved

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:

 

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:

 

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

 

PS. if I use the following

 

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

 

 

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 

 

 

2 Replies