Forum Discussion
Issue faced in dynamic cluster assignment to ids on dynamic aggregation of codes used linked to week
I am trying to develop a visual in Power BI which shows the distribution of ID by clusters based on counts of codes applied and I want to do it dynamically based on a week slicer.
Let me explain my requirement with some sample data attached in the PowerBI. I have a table(Main_Table) of 3 columns, they are: 'Weeks','id','code_types'. Now when I am counting 'code_types' ,grouping by 'id' only, I am getting 2 columns: 'id' and 'count_of_code_types' , then creating a derived column 'codes_distribution' from 'count_of_code_types' column by creating segments/groups , like '1 code','2-3 codes','4 codes','5 codes' and 'More than 5 codes'. Now I am creating a clustered bar chart with axis as 'codes_distribution' and in the values as distinct count of 'id', I am getting the desired visual chart.
However when I am grouping by 'Weeks','id' and getting 'count_of_code_types' , then the counts of code_types are getting split between the weeks here and thus creating a derived column 'codes_distribution' similarly will have different static segments. Hence now the segments/groups are like '1 code','2-3 codes' only and creating a clustered bar chart with this 'codes_distribution' as axis will create a bar chart with 'codes_distribution' as axis . Hence how can I get the bar chart as before, so that it will create 'codes_distribution' column dynamically based on the week selected by taking sum of code applied across the selected weeks for an ‘id’?
I am sharing the link to the power bi desktop file which is having the data and corresponding visuals.https://drive.google.com/drive/u/0/folders/1gsSLyuz0R0swTKkoLPyD8QpxtfqRuRe9
10 Replies
- amitchandak
Super User
Anonymous , Based on what I got you to need to dynamic segmentation using independent table and meausre.
refer my video : https://www.youtube.com/watch?v=CuczXPj0N-k
or these blog for help
https://www.daxpatterns.com/dynamic-segmentation/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization- AnonymousNot applicable
Hi @amitchandak , I have tried creating the visual based on the video you referred, but could not create visual as per the measures. It will be really helpful if you suggest me based on the fields of the given data.
- v-easonf-msft
Community Support
Hi, Anonymous
Considering the sensitive information in your report, can you upload a simplified version of this model file to Onedrive ?
Best Regards,
Community Support Team _ Eason- AnonymousNot applicable
Hi v-easonf-msft , thanks for your reply. I have masked the fields of my actual data and created a dummy data with reports in Power BI , so that anyone can access the file and the data and play around with it. Hence I would request you to go with the dummy/sample data that I have given in the link.
- AnonymousNot applicable
Hi v-easonf-msft as I told, the data and visuals you can refer to for demonstrating the solution, hence looking forward to it. Thanks again.
- v-easonf-msft
Community Support
Hi, Anonymous
Sorry, due to company policy, I cannot use Google drive for access.😞
This is why I hope you can share your files to Onedrive for Bussiness.
Best Regards,
Community Support Team _ Eason- AnonymousNot applicable
Hi v-easonf-msft , thanks for the reply. I am sharing the PBIX file in the link of one-drive-business:
- v-easonf-msft
Community Support
Hi, Anonymous
It seems that external user's access is restricted.Can you recheck the permission of external users?
were-sorry-but-cant-be-found-in-sharepoint
Best Regards,
Community Support Team _ Eason- AnonymousNot applicable
Hi v-easonf-msft , Pls find the link , it should be worked with now:
- v-easonf-msft
Community Support
Hi, Anonymous
It seems that you need to change the cross filter direction between tables to 'both'.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.