Forum Discussion
Dynamic page filter based on attribute's value
Hi, Anonymous
According to your description, I think you can achieve this using measure and visual filter, then I created some simple data to make a test, you can try my steps:
This is my test data:
I create a measure in the ‘Big table’:
Flag =
var _month=MAX('Small table'[Month])
return
IF(MAX('Big table'[Month number])=_month,1,0)
Then I created a table chart and place it and apply a filter like this:
And you can get what you want.
You can download my test pbix file below
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years agoNot applicable
Thanks a lot for the detailed answer.
I think what you propose is close to what I want, except that I have some troubles understanding this line :IF(MAX('Big table'[Month number])=_month,1,0)In particular, what is the purpose of the MAX() aggregation in this formula? I don't understand why an aggregation is needed here.
NOTE : Multiple rows in the big table should match the attribute of the small table. I don't think this changes something in your answer.
- v-robertq-msft5 years agoCommunity Support
Hi, Anonymous
When we use the max function like this in a measure, we can get the column value of the current row, so (max ('Big table '[month number]) is to get the value of [month number] of each current line of visual chart obtained here.
In other words, this MAX() function acts as an aggregation, but it only targets the current line. Do you understand what I mean?
More info about the MAX() function
Thank you very much!
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years agoNot applicable
Alright I see, thanks for the explanation.
Now about the behavior of this : It's actually kind of weird because it doesn't give the same result as applying a page filter (as explained in the initial question) whereas conceptually for me this should do the same.
It appears the page filter filters more, meaning that there are more rows with your solution than with the page filter (and the right solution is with the page filter : I compared the data with what's on the database.)
Could it be a problem of filtering / computation order ? It also appears that for some visuals it works fine and for some others it doesn't...
If you have any idea of what's happening that would be great, otherwise I guess I'll continue investigating on my own since I cannot upload any of the data in here to illustrate specifically the problem.
Thanks