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

How to apply page level filters at aggregated data

Hi,

 

I have data which looke something like this:

 

L1L2L3ScoreRespones
AA1A11822
AA1A11644
AA1A121038
AA2A21116
AA2A21535
AA2A23031
AA3A31845
AA3A32147
AA3A32216
AA3A331029
BB1B11849
BB1B11523
BB1B12523
BB1B12626
BB2B21248
BB2B22332
BB2B221010
BB3B31733
BB3B32249
BB3B32533
CC1C11241
CC1C11826
CC1C12541
CC2C21748
CC2C21513
CC2C22010
CC2C22646
CC3C31523
CC3C31439
CC3C31713

 

Now, I am representing the data in a matrix visual in power bi where L1, L2 and L3 columns are in rows in drill down manner and Score and responses are coming as columns. 

L1, L2 and L3 columns are showed as drilled down (L3 being aggreagted to L2 being aggregated to L1).

For the responses column, my data is getting summed up while aggregating and I have the same column in page level filter as well.

 

Now, let's say that the data at aggregated column looks like this:

 

L1ScoreResponses
A5323
B5.3326
C5.4300

 

the problem that I am facing is when I want to apply response filter at this level (let's say to filter out responses <300),

my filter is working at the L3 level (or the lowest level) and removing those records which have low responses at L3 level. Whereas I want it to remove the records at the L1 level (in this case if I apply responses<300, I should only see A and B rows.)

Is it achievable through a DAX query or doing something in Power BI so that the filters act on the level at which my visualization is currently and not at the base level.

 

Thanks for helping

Regards

 

@Anonymous @Cmcmahan @parry2k @dax @MatthewR 

1 ACCEPTED SOLUTION
helassal
Resolver II
Resolver II

Hi @Anonymous ,

 

Check this out:

 

FilterPageDynamicallyBasedOnHierarchy.jpg

 

 

 

 

 

 

 

I first created a slicer based on a calculated table that generates a column populated with numbers from 1 to 1000:

Range = GENERATESERIES(0,1000,1)
 

And then created a measure that first aggregates the response for each group in a visual and then compare the aggregation value to the minimum and maximum values of the slicer:

m_SumOfResponses =
var r = sum('Table'[Respones])

Return
if(r >= min(Range[Value]) && r <= max(Range[Value]),r)

 

 

 

Here's the sample file for reference: Sample Power BI File 

 

Please let me know if this solves your problem.

View solution in original post

2 REPLIES 2
helassal
Resolver II
Resolver II

Hi @Anonymous ,

 

Check this out:

 

FilterPageDynamicallyBasedOnHierarchy.jpg

 

 

 

 

 

 

 

I first created a slicer based on a calculated table that generates a column populated with numbers from 1 to 1000:

Range = GENERATESERIES(0,1000,1)
 

And then created a measure that first aggregates the response for each group in a visual and then compare the aggregation value to the minimum and maximum values of the slicer:

m_SumOfResponses =
var r = sum('Table'[Respones])

Return
if(r >= min(Range[Value]) && r <= max(Range[Value]),r)

 

 

 

Here's the sample file for reference: Sample Power BI File 

 

Please let me know if this solves your problem.

Anonymous
Not applicable

Hey @helassal ,

 

Thanks for your response. 

The method you suggested was working fine for me.

One thing that I added here is that in your case, the row will only vanish if there is only one column in the data, but if there are other columns as well, then it will not remove the entire row.

To work on that, I applied the same condition on all the measures that are pulled as columns and it was working fine then

Eg:

var r = sum('Table'[Respones])

Var temp = sumx(table1, score*responses)/sum(responses)

Return
if(r >= min(Range[Value]) && r <= max(Range[Value]), temp)

 

Thanks for the help!

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.