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.
Hi,
I have two tables with me. One is table 1, which has a column "Market" in it, and another table is table 2, which has "Customer" in it. Table 1 is linked with table 2 via Customer ID (Many to many relationship). Now, I have created a measure that is calculating sum of sales (Column sales present in table 1). Now what I need is, I have to create a table (visual) with 4 columns : First one being the "Market" (coming from table 1), second one being "Rank of customer" in that market based on total sales, third being the "Customer", forth being "Total Sales". I have attached an excel screenshot for what I need:
I want help creating ranking measure to achieve the same. Please note, I dont want to create a table in backend as the measure total sales will be dynamic ( to calculate current month, ytd, mat values), hence I want this to be in a table visual.
Please help, I m stuck for a day now, and now looking for experts.
Thanks a lot, hope I was as clear as possible.
Solved! Go to Solution.
Hi @Sameer94 ,
You Sheet 2 has customer id C_2 for multiple customers. Pls check that,
You will need to create a Calculated Colum for Lookup of Customer from Sheet 2.
then create 2 Measures
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Hi @Sameer94 ,
Create 2 measures
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Hi @harshnathani ,
The solution you mentioned was so close that it literally got me excited, however the catch is if I bring Customer Name into the table visual created, the system breaks, the ranking breaks. Can you get the code in such a way that I can get the corresponding customer name next to the customer ID or only just the customer name, and the ranking still works ?
Thanks a lot sir.
Hi @Sameer94 ,
You Sheet 2 has customer id C_2 for multiple customers. Pls check that,
You will need to create a Calculated Colum for Lookup of Customer from Sheet 2.
then create 2 Measures
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
This solution worked perfectly sir .... Thanks a lot 🙂
Also thanks for everyone else for replying 🙂
you can create two measures
total = CALCULATE(sum(tbl1[Sales]),ALLEXCEPT(tbl1,tbl1[market],tbl1[customer]))
ranking =
RANKX(ALLEXCEPT(tbl1,tbl1[market]),[total],,DESC,Dense)
However, I am stuck on the sorting. I think you want to group by market and sort by ranking.
Let's see if someone else can help you on that.
Proud to be a Super User!
I am trying to upload a pbix file but cant find any option to upload ... The thing is as you did ... the Customer column is in same table ... for me its in different table (table 2) and as I dont want to do Lookupvalue () coz the original pbix file is already 3gb. Can you let me know how to upload a sample pbix file here ?
Please follow the link to get to the sample pbix file (and do not bring market and customer columns from different tables into one table through query editor or via Data section, they both will be together in table/matrix visual only ) :
https://drive.google.com/file/d/19Ihh00kzK-zYbqH68soDNsQp3L0yajmT/view?usp=sharing
Thanks for replying
@Sameer94 , refer sub-category rank in measure rank link
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
80 | |
63 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |