Forum Discussion
How to hide data dynamically based on a number of data
Hi everyone,
I don't know if this was asked earlier, but seems to me I can't find the solution for the following problem.
The problem I'm facing is I that need to dynamically hide or show data based on a user filtering or filter context.
To illustrate my example: I'm having this dataset and I want to dynamically hide the bars OR turn off the legend when the number of Units Sold is lower than a certain number. Let's say for example lower than 51k. In this case the first bar needs to disappear or not have a legend on it (while the rest of the bars needs to keep showing all their information and not disappear).
Also when a user clicks on the slicer on the top right and the bars go lower than 51k, they also should disappear or turn off their legend.
I know the solution to this isn't going to be simple, but I'm hoping that there is one.
Thanks in advance!
Hi Anonymous
You haven't supplied any sample data so I've recreated my own and it's obviously not going to match yours. However, with my data I have created a measure that calculates the Total Units Sold per month.
Total Units Sold = CALCULATE(SUM('DataTable'[Units Sold]), FILTER(ALL('DataTable'), 'DataTable'[Date] = SELECTEDVALUE('DataTable'[Date])))This is then added as a filter to the clustered column visual
So now if any columns don't have in excess of 250,000 total units sold across all products, that column is not displayed.
Try this with your data, see my attached file for reference. If you can't get it to work please post back with some sample data.
Regards
Phil
2 Replies
- PhilipTreacy
Super User
Hi Anonymous
You haven't supplied any sample data so I've recreated my own and it's obviously not going to match yours. However, with my data I have created a measure that calculates the Total Units Sold per month.
Total Units Sold = CALCULATE(SUM('DataTable'[Units Sold]), FILTER(ALL('DataTable'), 'DataTable'[Date] = SELECTEDVALUE('DataTable'[Date])))This is then added as a filter to the clustered column visual
So now if any columns don't have in excess of 250,000 total units sold across all products, that column is not displayed.
Try this with your data, see my attached file for reference. If you can't get it to work please post back with some sample data.
Regards
Phil
- v-henryk-mstf
Community Support
Hi Anonymous ,
I have done the testing and think the solution provided by PhilipTreacy is worthy of reference.
If the problem is still not resolved, please point it out. Looking forward to your reply.
Best Regards,
Henry