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,894 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,380 points
1,557 views
+1 vote
1 answer

Unable to install connector for Power Bi and PostgreSQL

I think the problem is not at ...READ MORE

answered Aug 22, 2018 in Power BI by nirvana
• 3,130 points
2,698 views
+1 vote
1 answer

Connect power bi desktop to dataset and create custom reports

Yes using Power BI REST API to ...READ MORE

answered Sep 18, 2018 in Power BI by Kalgi
• 52,350 points
1,622 views
0 votes
1 answer

Is government, academic and nonprofit pricing available for Power BI?

Yes, nonprofit pricing is available when purchasing ...READ MORE

answered Sep 26, 2018 in Power BI by Kalgi
• 52,350 points
568 views
0 votes
1 answer

​Embed Power BI dashboard tile and make it auto update

This feature is not currently available with ...READ MORE

answered Sep 28, 2018 in Power BI by Kalgi
• 52,350 points
1,745 views
+1 vote
3 answers

Send dashboards and reports as automated emails on power bi

also, check - https://bihelper.tech It is a cloud service ...READ MORE

answered Oct 14, 2019 in Power BI by Andrew Caulton
21,054 views
+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,422 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,137 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,590 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,540 points
1,076 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