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
Anonymous
Not applicable

Compare values in a row with a measure dynamically

I need help please

 

IDTierConditionRateTermYear
1ANew0.252015
2BUsed0.552014
3ANew0.432014
4CUsed0.4532015
5D

Used

0.2422015
6CUsed0.1542014
7ANew0.7522014
8BUsed0.812014
9BUsed0.3512015
10DUsed0.1262015
11CNew0.7832015
12AUsed0.4522014


considering this table, I would like to calculate the median Rate with the Year and Condition columns as slicers in the following way:

If 2014 is selected on the Year slicer for instance "Used" is selected on the Condition slicer, i would like the following output

 

IDTierConditionRateTermYearMedian RateRate Greater than Median
2BUsed0.5520140.475Yes
6CUsed0.15420140.475No
8BUsed0.8120140.475Yes
12AUsed0.45220140.475No

 

And if Year slicer is "2015" and Condition Slicer is "used" for instance, this should be the result

IDTierConditionRateTermYearMedian RateRate Greater than Median
4CUsed0.45320150.295Yes
5DUsed0.24220150.295No
9BUsed0.35120150.295Yes
10DUsed0.12620150.295No



Can anyone show me how i can achieve this please?

5 REPLIES 5
v-lili6-msft
Community Support
Community Support

hi, @Anonymous

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

I havent't had time to check till now. However, I actually want the Rate Greater Than Median as a calculated column and not as a measure please

hi, @Anonymous

First, You should know that the difference between calculated columns and measures

for your case, it's better to use measure instead of column.

Second, if you want create a column you could use EARLIER Function as below:

Column = 
IF (
    CALCULATE ( SUM ( Table1[Rate] ) )
        > CALCULATE (
            MEDIAN ( Table1[Rate] ),
            FILTER (
                Table1,
                Table1[Year] = EARLIER ( Table1[Year] )
                    && Table1[Condition] = EARLIER ( Table1[Condition] )
            )
        ),
    "Yes",
    "No"
)

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I intend to use this as a slicer and in another case in the column section of a matrix visual. A measure cant be used in these cases

v-lili6-msft
Community Support
Community Support

hi, @Anonymous

You could try to use this formula to create a measure as below:

Rate Greater than Median = IF(CALCULATE(SUM(Table1[Rate]))>CALCULATE(MEDIAN(Table1[Rate]),ALLSELECTED(Table1)),"Yes","No")

Result:

1.JPG2.JPG

 

Best Regards,

Lin

 

Community Support Team _ Lin
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.