Forum Discussion
How to apply legends in shape Map visual using calculated column or dax
- 7 years ago
Hi spathak04
In Queries Editor
Select “GDP”,”Population”.. columns, then select “Unpivot columns”
Close &&Apply, Go to Data View, create a calculated column
category = VAR GDPCategory = IF ( Sheet3[Value] >= 25, "25% or more", IF ( Sheet3[Value] >= 10, "10% - 25%", IF ( Sheet3[Value] >= 3, "3% - 10%", IF ( Sheet3[Value] > 0, "0% - 3%", IF ( Sheet3[Value] < 0, "less than 0%", "no data" ) ) ) ) ) VAR PopulationCategory = IF ( Sheet3[Value] >= 3000, "3000 or more", IF ( Sheet3[Value] >= 1200, "1200 - 3000", IF ( Sheet3[Value] >= -550, "-550 - 1200", "no data" ) ) ) RETURN SWITCH ( Sheet3[Attribute], "GDP", GDPCategory, "Population", PopulationCategory )Best Regards
Maggie
Hi spathak04
In Queries Editor
Select “GDP”,”Population”.. columns, then select “Unpivot columns”
Close &&Apply, Go to Data View, create a calculated column
category =
VAR GDPCategory =
IF (
Sheet3[Value] >= 25,
"25% or more",
IF (
Sheet3[Value] >= 10,
"10% - 25%",
IF (
Sheet3[Value] >= 3,
"3% - 10%",
IF (
Sheet3[Value] > 0,
"0% - 3%",
IF ( Sheet3[Value] < 0, "less than 0%", "no data" )
)
)
)
)
VAR PopulationCategory =
IF (
Sheet3[Value] >= 3000,
"3000 or more",
IF (
Sheet3[Value] >= 1200,
"1200 - 3000",
IF ( Sheet3[Value] >= -550, "-550 - 1200", "no data" )
)
)
RETURN
SWITCH (
Sheet3[Attribute],
"GDP", GDPCategory,
"Population", PopulationCategory
)
Best Regards
Maggie
v-juanli-msft Hello,
Did you find any solution for the sort order on legends?
Thanks
- v-juanli-msft7 years agoCommunity Support
Hi spathak04
I see this link which you post the "sort legend" problem.
TomMartens has point out the right direction to do this.
For your problem when inplement this method, i would like to explain here.
From your information, you created a calculated column using the column which need to be sorted, right?
In this way, it doesn't work.
Could you open the "Queries Editor", if so, go to "Queries Editor" , create a custom column to define your column's order.
Then close&&apply, in the Report view, "sort your column by this custom column", it should work.
If you have any problem, please let me know.
Best Regards
Maggie
- spathak047 years agoHelper II
v-juanli-msft
Yes his solution was correct when I was using different bookmark for each attribute. But now I am using a dropdown for my attributes like (GDp , population and etc). my table structure is like this: -
I am not sure how to write custom sort order logic in query editor. As before I created different sort order columns each for GDp, Population etc. Now I have every attribute in one column.
I tried to add custom sort order column but every attribute has different categories/ values. Bu this will not work.
Can you please show me how it should be done. Thanks
- stonegg4 years agoRegular Visitor
Hi, I have similar question on this issue. Can you tell me where to find the solution for sort order on those dynamic legend that was determined by the filters?