cancel
Showing results for
Did you mean:
Highlighted

## 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

## 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, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
Solution Supplier

## 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

## 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, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

## Re: legend on map with range of data

Thanks @v-shex-msft!

Solution Supplier

## 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

Regular Visitor

## Re: legend on map with range of data

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

Announcements

#### ‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

#### Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

#### April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

#### MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors