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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Claudio_Prado
Regular Visitor

Add parameter value to a specific table/matrix column value to simulate totals

Hello all, 

 

I'm looking for a way to change the value of a specific column in a matrix to simulate totals based on a value of a parameter. I need to change the "Role A" value in column "31-Dec-99".

I wonder if a possible solution by either:

a) Replace the value directly based on the entry of the parameter value SIM A

b) create a separate table with the parameter value SIM A and then append/combining to the matrix alongside the original values and get the sum of it

c) create a 3rd set of values based on totals from the table and then add the parameter value

d) Another simple solution, since I´m a newbie, messing with complex formulas is challenging! 

 

Claudio_Prado_0-1674558454250.png

The original table looks like this:

 

RoleSum of ValueDate
A1002-Jan-23
A1003-Mar-23
A031-Dec-99
B2002-Jan-23
B2003-Mar-23
B031-Dec-99
C3002-Jan-23
C3003-Mar-23
C031-Dec-99

 

Thanks!

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi, @Claudio_Prado 

According to your description, you want to change the value of the slicer and overwrite the value of [Role]="A" && [Date]="1999/12/31".
First, if you're going to implement several, you need to repeat my approach.
Also, in Power BI, I don't currently have a way to save the values of your slicers in a table.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1674702494211.png

(2)We need to create a what-if parameter in Power Bi Desktop like this:

vyueyunzhmsft_1-1674702520295.png

vyueyunzhmsft_2-1674702528425.png

(3)Then we need to create two measures:

Measure = var _slicer_value = [Parameter Value]
var _role = MAX('Table'[Role])
var _date = MAX('Table'[Date])
return
IF(_role="A" && _date = DATE(1999,12,31) , _slicer_value , SUM('Table'[Sum of Value]))
Measure 2 = SUMX( ADDCOLUMNS(CROSSJOIN(VALUES('Table'[Role]) ,VALUES('Table'[Date])), "value" , [Measure]) , [value])

 

(4)Then we can put the fields we need on the visual and we can meet your need.

vyueyunzhmsft_3-1674702579370.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi, @Claudio_Prado 

According to your description, you want to change the value of the slicer and overwrite the value of [Role]="A" && [Date]="1999/12/31".
First, if you're going to implement several, you need to repeat my approach.
Also, in Power BI, I don't currently have a way to save the values of your slicers in a table.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1674702494211.png

(2)We need to create a what-if parameter in Power Bi Desktop like this:

vyueyunzhmsft_1-1674702520295.png

vyueyunzhmsft_2-1674702528425.png

(3)Then we need to create two measures:

Measure = var _slicer_value = [Parameter Value]
var _role = MAX('Table'[Role])
var _date = MAX('Table'[Date])
return
IF(_role="A" && _date = DATE(1999,12,31) , _slicer_value , SUM('Table'[Sum of Value]))
Measure 2 = SUMX( ADDCOLUMNS(CROSSJOIN(VALUES('Table'[Role]) ,VALUES('Table'[Date])), "value" , [Measure]) , [value])

 

(4)Then we can put the fields we need on the visual and we can meet your need.

vyueyunzhmsft_3-1674702579370.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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