Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
dsilveira
Advocate I
Advocate I

legend on map with range of data

Hi I'm trying to use a map to show the sales by State. I have this...

map.JPG

Of course all State have different amount od sales. I would like show it by range, something like that for the legend:

legend.JPG

Thanks in advance...

 

2 ACCEPTED SOLUTIONS
v-shex-msft
Community Support
Community Support

Hi @dsilveira,

 

Based on your description, you want to use the data range as the legend, right?
If as I said, you can add a calculate column to calculate the range of the value, then drag it to the “Legend” property in a Filled map visual.


Dax formula:

 

Value Range = 
if(Sheet1[Amount]<=4000,"0~4000",
                if(AND(Sheet1[Amount]>4000,Sheet1[Amount]<=8000),"4000~8000",
                                if(AND(Sheet1[Amount]>8000,Sheet1[Amount]<=12000),"8000~12000",
                                                if(AND(Sheet1[Amount]>12000,Sheet1[Amount]<=16000),"12000~16000",
                                                                if(AND(Sheet1[Amount]>16000,Sheet1[Amount]<=20000),"16000~20000",                           
                                                                                if(AND(Sheet1[Amount]>20000,Sheet1[Amount]<=24000),"20000~24000",
                                                                                                if(AND(Sheet1[Amount]>24000,Sheet1[Amount]<=28000),"24000~28000",
                                                                                                                if(AND(Sheet1[Amount]>32000,Sheet1[Amount]<=36000),"32000~36000",
                                                                                                                                if(AND(Sheet1[Amount]>36000,Sheet1[Amount]<=40000),"36000~40000","40000+")))))))))

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

PavelR
Solution Specialist
Solution Specialist

Hi @dsilveira. Just in case if you do not like the nested IFs Smiley Happy, you can use this DAX syntax. It is much more clear to read and to edit.

 

RANGES = SWITCH(TRUE();AND([Measure]>=0;[Measure]<10);"0 to 9";AND([Measure]>=10;[Measure]<20);"10 to 19";[Measure]>=20;"20 and more")

 

Regards.

Pavel

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @dsilveira,

 

Based on your description, you want to use the data range as the legend, right?
If as I said, you can add a calculate column to calculate the range of the value, then drag it to the “Legend” property in a Filled map visual.


Dax formula:

 

Value Range = 
if(Sheet1[Amount]<=4000,"0~4000",
                if(AND(Sheet1[Amount]>4000,Sheet1[Amount]<=8000),"4000~8000",
                                if(AND(Sheet1[Amount]>8000,Sheet1[Amount]<=12000),"8000~12000",
                                                if(AND(Sheet1[Amount]>12000,Sheet1[Amount]<=16000),"12000~16000",
                                                                if(AND(Sheet1[Amount]>16000,Sheet1[Amount]<=20000),"16000~20000",                           
                                                                                if(AND(Sheet1[Amount]>20000,Sheet1[Amount]<=24000),"20000~24000",
                                                                                                if(AND(Sheet1[Amount]>24000,Sheet1[Amount]<=28000),"24000~28000",
                                                                                                                if(AND(Sheet1[Amount]>32000,Sheet1[Amount]<=36000),"32000~36000",
                                                                                                                                if(AND(Sheet1[Amount]>36000,Sheet1[Amount]<=40000),"36000~40000","40000+")))))))))

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

when i use the expression it throw an error stating multiple aruguments are not allowed 

Thanks @v-shex-msft!

PavelR
Solution Specialist
Solution Specialist

Hi @dsilveira. Just in case if you do not like the nested IFs Smiley Happy, you can use this DAX syntax. It is much more clear to read and to edit.

 

RANGES = SWITCH(TRUE();AND([Measure]>=0;[Measure]<10);"0 to 9";AND([Measure]>=10;[Measure]<20);"10 to 19";[Measure]>=20;"20 and more")

 

Regards.

Pavel

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.