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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
arnebracke
New Member

Filtering on values of frequency tables

Hi there, 

 

I always suffer with frequency tables in Power BI. See next example:

  • Activities are being logged per patient with a certain start date and duration. Raw data looks like this:
    arnebracke_0-1645270769662.png
  • I want to build a report based on the number of activities per patient (typical frequency table)
    • It should reflect any date / other filters used on the page
    • It should be possible to filter the page when selecting 1 of the frequency results,
      • E.g. Select the patients with 3 activities -> what is the effect on the average duration

This how far I got:

arnebracke_1-1645271003824.png

For the frequency calculation, I used a measure based on a supporting frequency table (definition of the different bands), but of course there is no link between this frequency table and the data -> so clicking on the "3 column" in the column chart, does'nt have any effect on the globals measures (data table is not filtered):

arnebracke_2-1645271172698.png

Is there a way to achieve this filtering funcitonality based on results in the frequency table?

Very looking forward to your answers, it kept me awake all night 😉

 

Link to the pbix-file

 

 

3 REPLIES 3
arnebracke
New Member

Hello Winniz, 

 

Thanks for your response.

Your solution works fine to filter the data table, but it does not work for any measure that are added on the page:

arnebracke_0-1645558221846.png

Measures as average duration or # activities are not adjusted when filtering by clicking the frequency chart...

 

Best regards,
Arne

 

Hi @arnebracke ,

 

Please update the formula to:

 

Measure = 
VAR Count_ =
    CALCULATE (
        [#count],
        FILTER ( ALLSELECTED ( Data ), Data[Patient_ID] = MAX ( Data[Patient_ID] ) )
    )
VAR freq = SWITCH ( Count_, 1, "1", 2, "2", 3, "3", "3+" )
VAR selectfreq = SELECTEDVALUE ( FreqGroups[Freq] )
RETURN
    IF (
        selectfreq = BLANK (),
        1,
        COUNTROWS (
            FILTER ( VALUES ( Data[Patient_ID] ), freq = MAX ( FreqGroups[Freq] ) )
        )
    )

 

Then add this filter to each visuals:

 

vkkfmsft_0-1645605423061.png

vkkfmsft_1-1645605639652.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

v-kkf-msft
Community Support
Community Support

Hi @arnebracke ,

 

Please create the measure and filter table visual when the measure is not blank.

 

Measure = 
VAR Count_ =
    CALCULATE (
        [#count],
        FILTER ( ALLSELECTED ( Data ), Data[Patient_ID] = MAX ( Data[Patient_ID] ) )
    )
VAR freq = SWITCH ( Count_, 1, "1", 2, "2", 3, "3", "3+" )
VAR selectfreq = SELECTEDVALUE ( FreqGroups[Freq] )
RETURN
    IF (
        selectfreq = BLANK (),
        Count_,
        COUNTROWS (
            FILTER ( VALUES ( Data[Patient_ID] ), freq = MAX ( FreqGroups[Freq] ) )
        )
    )

vkkfmsft_0-1645509475842.png  

vkkfmsft_1-1645509550655.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors