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

Calculate rank on the fly based on the slicer and filter the rank and summarize the filtered data

Hi,

 

Scenario:                                                                                                                                                                                                                                                                                                                                                                                                             

I wanted to calculate rank on the fly based on the date slicer chosen and then I wanted to find the average of value and count of participants grouped by section for rank=1 participants

 

What I did to get rank on the fly:       

                                                                                       

I have calculated two measures :

  • Mindate measure
  • Rank measure                                                                                                                                                  

Mindate Measure:                                                                                         

Date=min(Query2[date])    

                                                                                         

Rank Measure :                                                                                

Rank = rankx(filter((Query2),Query2[Participant]=min(Query2[participant])),[MinDate],,1)           

 

By using above two measures, I have calculated rank dynamically based on the date slicer     

                                                                                         

Table with rank 

 

ParticipantDateSectionValueRank
1001/3/2018 10:37371
1001/23/2018 10:362242
1003/22/2018 15:08353
2222/22/2018 14:41361
2223/20/2018 14:382342
3331/18/2018 10:412291
4441/11/2018 11:052421
5551/10/2018 14:232261
5551/30/2018 12:443102
5553/12/2018 16:192323

 

I am facing problem to get the below results..                                                                                                                                                                                                                                                                                    

I am interested only in rank= 1 data & want the result as average of the value & count of participants by grouping Section for rank =1 participants  

 

Result 1:

To get rank =1 participants data

 

ParticipantDateSectionValueRank
1001/3/2018 10:37371
2222/22/2018 14:41361
3331/18/2018 10:412291
4441/11/2018 11:052421
5551/10/2018 14:232261

 

  Result 2: Summarized data for rank=1 participants                              

SectionAverage of ValueCount of Participant
36.52
227.52
2421

 

I would really appreciate if someone can help me on this..       

 

Thanks

Suman                                                                                                  

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try these MEASURE

 

Average Value =
CALCULATE (
    AVERAGE ( Query2[Value] ),
    FILTER ( VALUES ( Query2[Participant] ), [Rank] = 1 )
)
Count of Participant =
CALCULATE (
    DISTINCTCOUNT ( Query2[Participant] ),
    FILTER ( VALUES ( Query2[Participant] ), [Rank_] = 1 )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

Anonymous
Not applicable

Hey Zubair, Thanks a lot..It worked..

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

please help me in this..

 

thanks

Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try these MEASURE

 

Average Value =
CALCULATE (
    AVERAGE ( Query2[Value] ),
    FILTER ( VALUES ( Query2[Participant] ), [Rank] = 1 )
)
Count of Participant =
CALCULATE (
    DISTINCTCOUNT ( Query2[Participant] ),
    FILTER ( VALUES ( Query2[Participant] ), [Rank_] = 1 )
)

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

Hi Zubair,

 

When I have slicer for participant, average measure is not calulcating properly

 

Please seee attached screenshot with highlighted : instead of 6 it should be 7q.PNG

I have used this measure:

 

Average Value =
CALCULATE (
    AVERAGE ( Query2[Value] ),
    FILTER ( VALUES ( Query2[Participant] ), [Rank] = 1 )
)

 

 

 

Thanks inadvance

Anonymous
Not applicable

Hi Zubair,

 

When I have slicer for participant, average measure is not calulcating properly

 

Please seee attached screenshot with highlighted : instead of 6 it should be 7q.PNG

I have used this measure:

 

Average Value =
CALCULATE (
    AVERAGE ( Query2[Value] ),
    FILTER ( VALUES ( Query2[Participant] ), [Rank] = 1 )
)

 

 

 

Thanks inadvance

Anonymous
Not applicable

Hey Zubair, Thanks a lot..It worked..

 

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.