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
New_be
Helper IV
Helper IV

Return values from previous parameters

Hi expert,

 

I have an issue with one of my report. Currently what I am doing in my report is like in table (1) below. I divided all RSS Value with PRD value (4,046.60).

 

But, what I really want is like in table (2) to get my desired percentage:
   if RSS=1, then it will return PRD Value, 4,046.60
   else if RSS= 2, then it will return Value of RSS 1 which is 3,028.08
   else if RSS= 3, then it will return Value of RSS 2 which is 2,025.34

 

*RSS column is whole number datatype

RSS_DenominatorLogic.jpg

Big thanks for your help 🤝

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @New_be 

 

You can try the following methods.

Measure = 
Var N1=MAXX(FILTER(ALL('Table'),[RSS]<SELECTEDVALUE('Table'[RSS])),[RSS])
Var N2=CALCULATE(SUM('Table'[VALUE]),FILTER(ALL('Table'),[RSS]=N1))
return
IF(SELECTEDVALUE('Table'[RSS])=1,SELECTEDVALUE('Table'[PRD Value]),N2)

vzhangti_0-1656678736308.png

In order to get Total to output the correct value, the IF(HASONEVALUE()) function is also required.

Pro = IF(HASONEVALUE('Table'[RSS]),[Measure],
SUMX(SUMMARIZE('Table',[RSS],"Pro",[Measure]),[Pro]))
Rercentage = DIVIDE(SUM('Table'[VALUE]),[Pro])

vzhangti_1-1656678985970.png

Does this match the output you expect?

 

Best Regards,

Community Support Team _Charlotte

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

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @New_be 

 

You can try the following methods.

Measure = 
Var N1=MAXX(FILTER(ALL('Table'),[RSS]<SELECTEDVALUE('Table'[RSS])),[RSS])
Var N2=CALCULATE(SUM('Table'[VALUE]),FILTER(ALL('Table'),[RSS]=N1))
return
IF(SELECTEDVALUE('Table'[RSS])=1,SELECTEDVALUE('Table'[PRD Value]),N2)

vzhangti_0-1656678736308.png

In order to get Total to output the correct value, the IF(HASONEVALUE()) function is also required.

Pro = IF(HASONEVALUE('Table'[RSS]),[Measure],
SUMX(SUMMARIZE('Table',[RSS],"Pro",[Measure]),[Pro]))
Rercentage = DIVIDE(SUM('Table'[VALUE]),[Pro])

vzhangti_1-1656678985970.png

Does this match the output you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Thanks! it works!

Seanan
Solution Supplier
Solution Supplier

Hi @New_be 

First create a calculated column with the following code:

Rank = RANKX(ALL(PRD),'PRD'[RSS],,ASC,Dense)

Then create another calculated column:

PreviousPRD = 
VAR CurrentIndex = 'PRD'[Rank]
VAR PreviousIndex = CALCULATE(MAX('PRD'[Rank]),FILTER('PRD','PRD'[Rank] < CurrentIndex),ALL('PRD'[Rank]))
VAR Result = CALCULATE(MAX('PRD'[Values]),FILTER('PRD','PRD'[Rank] = PreviousIndex))
return IF(Result = BLANK(),FIRSTNONBLANKVALUE('PRD'[PRD],'PRD'[PRD]),Result)

Finally create a 3rd calculated column

Divide = DIVIDE('PRD'[Values],'PRD'[PreviousPRD])

Result: 

NVIDIA_Share_XcmnMniakI.png

 

 

 

 

 

 

When you add the Divide column, don't forget to change the data format to percentage.

 

Kind regards,
Seanan
If this post helped, please consider accepting it as the solution.

New_be
Helper IV
Helper IV

Hi sir @amitchandak , can you please help me with this problem?

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.

Top Solution Authors