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
Justair07
Resolver I
Resolver I

How do I use SELECTEDVALUE in custom measure for Calculating Average

Hi,

 

I thought is would be easy but I'm stuck. How can I use SELECTEDVALUE in my measure:

EPP Active Avg = CALCULATE(AVERAGE('EPP Results PBI'[EPP Score]),'EPP Results PBI'[Days Employeed]>365,'EPP Results PBI'[Status]="Active")

Instead of having a static number of 365, I was wanting to use a slicer so the user can select the value. I have a table called Days and a column called Days. I then created a sliced which is populted by the Days table and Days column. Then I tried:

EPP Active Avg = CALCULATE(AVERAGE('EPP Results PBI'[EPP Score]),'EPP Results PBI'[Days Employeed]>SELECTEDVALUE(Days[Days]),'EPP Results PBI'[Status]="Active")

and I recieve this error:

error.JPG

What am I doing wrong?

 

Thank you,

-Justair07

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @Justair07 

The simplified syntax for the filter arguments does not allow that. You need the full version:

EPP Active Avg =
CALCULATE (
    AVERAGE ( 'EPP Results PBI'[EPP Score] ),
    FILTER (
        ALL ( 'EPP Results PBI'[Days Employeed] ),
        'EPP Results PBI'[Days Employeed] > SELECTEDVALUE ( Days[Days] )
    ),
    'EPP Results PBI'[Status] = "Active"
)

Please mark the question solved when done and consider giving kudos if posts are helpful.

 

Cheers  Datanaut

View solution in original post

2 REPLIES 2
AlB
Super User
Super User

Hi @Justair07 

The simplified syntax for the filter arguments does not allow that. You need the full version:

EPP Active Avg =
CALCULATE (
    AVERAGE ( 'EPP Results PBI'[EPP Score] ),
    FILTER (
        ALL ( 'EPP Results PBI'[Days Employeed] ),
        'EPP Results PBI'[Days Employeed] > SELECTEDVALUE ( Days[Days] )
    ),
    'EPP Results PBI'[Status] = "Active"
)

Please mark the question solved when done and consider giving kudos if posts are helpful.

 

Cheers  Datanaut

@AlB  Thakn you! Perfect!

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.