cancel
Showing results for
Did you mean:
Highlighted
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 ),
IF (
AND ( A2 >= 101, A2 <= 500 ),
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
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

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 ),
IF (
AND ( A2 >= 101, A2 <= 500 ),
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.

Announcements

Back to School Contest

Engage and empower students with Power BI!

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Top Kudoed Authors
Users Online
Currently online: 99 members 1,574 guests
Recent signins: