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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
gianmarco
Helper IV
Helper IV

How to make my measure responsive along with variations in other measure

Dear All,

 

I have the following table:

 

SECTIONNAMEVALUESDISCOUNT%
Amiga500It Came From The Desert5050
Amiga500Jaguar XJ2202520
Amiga500It Came From The Desert10050
Amiga500Jaguar XJ2204020
Amiga500Turrican II20030
Amiga500Turrican II50030
Amiga500Toki50035
Amiga500JaguarXJ22015020
Amiga500The First Samurai20060

 

And the following measures:

 

Measure1-Sum of values = SUM(Table[VALUES]

Measure2-Discounted values = SUMX(Table, IF(Table[SECTION]="Amiga500", [Measure1-Sum of values] * Table[DISCOUNT%]/100, BLANK()))

 

I created the following visualization in the form of a table:

 

NameValuesMeasure2-Discounted values
It Came From The Desert15075
Jaguar XJ22021543
Turrican II700210
Toki500175
The First Samurai200120

             Grand Total            1.765    623

 

At this point I wanted to make simulations so I set a PARAMETER: Through a slicer I can pick a single name and change its value (Values' grand total is changing too).

 

I have made this happen by creating other two measures:

 

Measure3-Values simulation 1 = IF(SELECTEDVALUE('Slicer Name'[Slicer Name])=MAX(Table[Name]),[Measure1-Sum of values]+(1+Parameter[Parameter Value]),[Measure1-Sum of values])

 

Measure4-Values simulation 2 = IF(HASONEVALUE(Table[Name]),[Measure3-Values simulation 1],SUMX(ALL(Table[Name],[Measure3-Values simulation 1]))

 

At this point I changed my visualization to appear as the following table:

 

NameMeasure4-Values simulation 2Measure2-Discounted values
It Came From The Desert15075
Jaguar XJ22021543
Turrican II700210
Toki500175
The First Samurai200120

                      Grand Total  1.765                                            623

 

Now I can change my values through the slicer... BUT...

 

my Measure2-Discounted values remains stuck.

 

How should I modify Measure2-Discounted values to make it be responsive along with the changes in values of Measure4-Values simulation 2 made with the use of the parameter?

You guys helped me a lot, I hope you can give assistance to me again with this.

Thank You in advance.

 

1 ACCEPTED SOLUTION

Hi, @gianmarco 

Sorry, I am not very clear about the logic of PLUS sign in your measure3 and cannot explain why it doesn't work this way.
I only know that no matter how the parameters change, the discount rate will never be affected, so I directly use the method of multiplying the discount rate to get the discount value.

 

If this is your expected result, please check my revised measure.

39.png

average discount% = CALCULATE(AVERAGE('Table'[DISCOUNT%]),ALLEXCEPT('Table','Table'[NAME]))
Measure5-Discounted values = [Measure4-Values Simulation2]*[average discount%]/100

(Here I use Measure 6 to correct the wrong total)

Measure6 = SUMX(VALUES('Table'[NAME]),[Measure5-Discounted values]) 

 

Best Regards,
Community Support Team _ Eason
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

7 REPLIES 7
v-easonf-msft
Community Support
Community Support

Hi,  @gianmarco 

Try to add a measure as below:

Measure5-Discounted values = SUMX('Table', IF('Table'[SECTION]="Amiga500", [Measure4-Values simulation 2] * 'Table'[DISCOUNT%]/100, BLANK()))

34.png

 

If it doesn't meet you requirement,please share more details.

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Dear @v-easonf-msft , I think we're almost there.

Please, check my Sample  file. 

 

The problem with your solution is that Measure5 displays an incorrect discounted value.

 

For example:

- the discounted value of "Turrican II" is doubled because it occurs two times in the database (If I add 100 to my simulated value, my Measure5 reports a discounted value of 60%, instead of 30%).

- the discounted value of "Jaguar XJ220" is tripled because it occurs three times in the database (If I add 100 to my simulated value, my Measure5 reports a discounted value of 60%, instead of 20%).

 

Thanks for your help

gianmarco

Hi, @gianmarco 

Your description confuses me even more.

If it is the situation in the picture below, can you share your specific expected result in excel?

35.png

I am also confused about the function of measure3. Can you explain it in detail?

37.png

If you want to get the value of times,maybe  you can try formula as below:

 

Times2 = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[NAME]))

 

or 

 

Times = 
var a=CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[NAME]=SELECTEDVALUE(Slicer[Slicer Name])))
return IF(ISBLANK(a),1,a)

 

Best Regards,
Community Support Team _ Eason

 

 

Dear @v-easonf-msft , I checked again and your solution is appropriate. Thank you very much.

 

Anyway, I was trying not to multiplicate my Measure1-sum of values for the value of the parameter, but to sum it/subtract it. That is why my Measure3 indicates the PLUS sign.

I can't explain why it doesn't work this way... Do you have any idea?

 

Citing your example: If "Turrican 2" would become 800 (original value = 700 + Parameter = 100), the discounted value would become 240 (discounted value associated to "Turrican II" = 30%).


Thanks again

 

(Gonna accept your solution anyway)

 

Hi, @gianmarco 

Sorry, I am not very clear about the logic of PLUS sign in your measure3 and cannot explain why it doesn't work this way.
I only know that no matter how the parameters change, the discount rate will never be affected, so I directly use the method of multiplying the discount rate to get the discount value.

 

If this is your expected result, please check my revised measure.

39.png

average discount% = CALCULATE(AVERAGE('Table'[DISCOUNT%]),ALLEXCEPT('Table','Table'[NAME]))
Measure5-Discounted values = [Measure4-Values Simulation2]*[average discount%]/100

(Here I use Measure 6 to correct the wrong total)

Measure6 = SUMX(VALUES('Table'[NAME]),[Measure5-Discounted values]) 

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Dear @v-easonf-msft, thank you for priceless help.

Anonymous
Not applicable

You've got to be more precise about what you want your measures to do in response to the slicer. Especially about the first measure you mention.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.