cancel
Showing results for
Did you mean:
Frequent Visitor

## legend on map with range of data

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

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

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team

## Re: legend on map with range of data

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 Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |
Established Member

## Re: legend on map with range of data

Hi @dsilveira. Just in case if you do not like the nested IFs , 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

4 REPLIES 4
Community Support Team

## Re: legend on map with range of data

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 Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |
Frequent Visitor

## Re: legend on map with range of data

Thanks @v-shex-msft!

Established Member

## Re: legend on map with range of data

Hi @dsilveira. Just in case if you do not like the nested IFs , 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

Highlighted
Frequent Visitor

## Re: legend on map with range of data

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