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,100 points
5,482 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
• 37,320 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 22 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

Unable to install connector for Power Bi and PostgreSQL

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

answered Aug 21, 2018 in Power BI by nirvana
• 3,060 points
475 views
0 votes
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
• 37,320 points
77 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
• 37,320 points
40 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
• 37,320 points
187 views
0 votes
2 answers

Send dashboards and reports as automated emails on power bi

check this: https://blog.devscope.net/2018/05/30/how-to-schedule-and-s ...READ MORE

answered Mar 21 in Power BI by Bob Jenkins

reshown Mar 22 by Vardhan 1,559 views
+1 vote
2 answers

Difference between Power BI pro and Power BI Premium

My answer is applicable for a company ...READ MORE

answered Oct 30, 2018 in Power BI by chiranjeevi
• 160 points
221 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,100 points

edited Oct 11, 2018 by Kalgi 109 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
• 37,320 points
52 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
• 37,320 points
3,671 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
• 14,080 points
93 views