cancel
Showing results for
Search instead for
Did you mean:
Highlighted
mjustintaylor Frequent Visitor

## Data Ranges

Hi Community.

In Excel, I can create a formula to give a result on ranges between certain values e.g.

=IF(AND(A2>=0, A2<= 100), "Answer A",IF(AND(A2>=101, A2<=500),"Answer B", IF(AND(A2>=501, A2<=1000),"Answer 3", "Void")))

Is there a Dax equivalent, so I can get this to work directly in Power BI when importing and combining several spreadsheets (the If, And doesn't work)

1 ACCEPTED SOLUTION

Accepted Solutions Community Support Team

## Re: Data Ranges

We should get the A2 by VAR like this.

```Measure =
VAR A2 =
CALCULATE ( SUM ( 'Table'[value] ), FILTER ( 'Table', 'Table'[index] = 2 ) )
RETURN
IF (
AND ( A2 >= 0, A2 <= 100 ),
"Answer A",
IF (
AND ( A2 >= 101, A2 <= 500 ),
"Answer B",
IF ( AND ( A2 >= 501, A2 <= 1000 ), "Answer 3", "Void" )
)
)
``` Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
AndrejZitnay Member

## Re: Data Ranges

Hello @mjustintaylor

Have you tried :

= IF(A2>=0 && A2 <=100,"Answer A","Answer B") or another combinations.

IF first option && IF second option, than ...

Andrej

mjustintaylor Frequent Visitor

## Re: Data Ranges

Thanks, Andrej

I will give this a go.

KRs

Justin Community Support Team

## Re: Data Ranges

We should get the A2 by VAR like this.

```Measure =
VAR A2 =
CALCULATE ( SUM ( 'Table'[value] ), FILTER ( 'Table', 'Table'[index] = 2 ) )
RETURN
IF (
AND ( A2 >= 0, A2 <= 100 ),
"Answer A",
IF (
AND ( A2 >= 101, A2 <= 500 ),
"Answer B",
IF ( AND ( A2 >= 501, A2 <= 1000 ), "Answer 3", "Void" )
)
)
``` Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

## Helpful resources

Announcements
Top Ideas Top Kudoed Authors
Users Online
Currently online: 99 members 1,574 guests
Recent signins:
• OwenAuger • pballew0 • • rexii23 • mussaenda • wwlpbd • e80704 Please welcome our newest community members:
• philpunter • thaoha • eebustamante • CVianello • andrewpp • barrychen0825 • kip88 