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 data data table and the table contain country id, country code and qty.
In visualisation, I like to breakdown by country id, country code and qty in matrix table.
At the moment all the country code showing in one column by country id but the expected result is one by one, row by column (country Id by country code). Is that possible to achieve in visuslation?
Example: Return the releevant country code in each columns. If country code - RS in row and column will be show only RS country code.
https://www.dropbox.com/s/18q4wdjaszlml3x/PBI%20VISUAL%20-MATRIX.pbix?dl=0
Solved! Go to Solution.
Hi @Saxon202202
I've edited the PBIX with a calculated column to rank Country Code by Country ID.
Index =
RANKX (
FILTER ( DATA, DATA[COUNTRY ID] = EARLIER ( DATA[COUNTRY ID] ) ),
DATA[COUNTRY CODE],
,
ASC,
DENSE
)
Proud to be a Super User!
Hi @Saxon202202,
If I got your user case right, my approach would be to create an index column for each Country ID, use that as the column header and use SELECTEDVALUE to show the country code in the row. This is the closest I could get to. Please refer to the attached PBIX
Proud to be a Super User!
Hello, Thanks for your suggestion. The country id is not part of raw data, it's came from DAX code based on the different columns so unable to modify the changes in Power query. Is that any chance can I have the same index output by using DAX code. I can get the same output in Excel by using COUNTIFS =COUNTIFS(A2:A$2,A2) but not sure how can make DAX code to get the same output.
Hi @Saxon202202
I've edited the PBIX with a calculated column to rank Country Code by Country ID.
Index =
RANKX (
FILTER ( DATA, DATA[COUNTRY ID] = EARLIER ( DATA[COUNTRY ID] ) ),
DATA[COUNTRY CODE],
,
ASC,
DENSE
)
Proud to be a Super User!
@danextian
Thank you so much for your help to make DAX code for Index. The last question is how do you made visual because I am unable to get the same visual output like you made it.
Can you please advise.
My visual is different compare to yours.
Hi @Saxon202202 ,
Change the column font color to white so they are not visible (with a white background of course). Then under Values, turn on Switch values to rows.
Proud to be a Super User!
Hi,
Could you please let me know your COUNTRY ID and COUNTRY CODE static or dynamic ?
Thank you.
Hi ,
This can be resolved using switch function
SWITCH =
SWITCH(
TRUE(),
SELECTEDVALUE(DATA[COUNTRY ID]) = "RS",SELECTEDVALUE(DATA[COUNTRY CODE]),
SELECTEDVALUE(DATA[COUNTRY ID]) = "PD",SELECTEDVALUE(DATA[COUNTRY CODE]),
SELECTEDVALUE(DATA[COUNTRY ID]) = "OQ",SUM(DATA[ORDER QTY])
)
BR
@Anonymous @, Thanks for your reply. The country id should be show the relevant country code.
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 |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |