Power BI Dax Multiple IF AND Statements

0 votes

I have a DAX query in Power BI. 

I have created a new column in the data and I want to Group AgeWhenFirstSold(Mo) into Age buckets.

The result I get from this query is 0-5 Months but the 6-11 Months doesn't show in the column

Group AgeWhenFirstSold(Mo)- 6 Months =
IF (
    AND ( Sheet1[AgeWhenFirstSold(Mo)] >= "0", Sheet1[AgeWhenFirstSold(Mo)] <= "5" ),
    "0 - 5 Months",
    IF (
        AND ( Sheet1[AgeWhenFirstSold(Mo)] > "5", Sheet1[AgeWhenFirstSold(Mo)] <= "11" ),
        "6 - 11 Months"
    )
)
Oct 5, 2018 in Power BI by lina
• 8,220 points
18,972 views

2 answers to this question.

0 votes

I suspect your issue is that alphabetically "11" <= "5"

Try using VALUE(<text>) "Converts a text string that represents a number to a number."

e.g. VALUE( Sheet1[AgeWhenFirstSold(Mo)] ) >= 0

answered Oct 5, 2018 by Kalgi
• 52,350 points
+1 vote
HI I have Column

Patient

12

13

14

15

18

IN Patient=12, 13

Out Patient=15,18 how to create a dax calculation in power bi?
answered May 23, 2019 by VNK
Hi, If your question is to classify them as IN Patients and Out Patients then below is the code -

IF(Table_name[Patient] < 14, "IN Patient","Out Patient").

If the above solution is not what you expect, then can you reframe your question.
what if the patient value = 14 ??
will it be considered IN or OUT as per this DAX??

I'm sure you can change the DAX expression to something as shown below if you want to consider 14 as an IN Patient.

IF(Table_name[Patient] <=14, "IN Patient","OUT Patient")

Related Questions In Power BI

0 votes
1 answer

DAX Power BI: Replaced blank values with zero and issue with chart

It seems like you're facing an issue ...READ MORE

answered Aug 22, 2023 in Power BI by anonymous
• 1,420 points
1,631 views
0 votes
1 answer
+3 votes
2 answers

Combine tables in Power BI

You can also achieve this using a ...READ MORE

answered Oct 5, 2018 in Power BI by lina
• 8,220 points

edited Oct 11, 2018 by Kalgi 2,488 views
0 votes
1 answer

Power Bi Dax Table

You need to wrap the numbers in ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 52,350 points
1,179 views
0 votes
1 answer

Distinct count filtered by condition using Power BI Dax

Try this, it should work: DistinctCountActiveMonths = CALCULATE( ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 52,350 points
37,689 views
0 votes
1 answer

Dax code for calculated columns

I would recommend you to adjust the ...READ MORE

answered Oct 22, 2018 in Power BI by Hannah
• 18,520 points
1,161 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP