Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello Power BI Noob seeks help with AND statement and text…
This is my data:
What I want to do have some sort of calculated column column that tells me which of the 3 groups the vaccination data fits into.
I have part of this working with numbers
Vac Category =
IF([Months since last Vac] <13,
12,
IF([Months since last Vac] >12,
24,
0)
)
This only tells me if something is less or more that 12 months
What I want to do is more like this:
Vac Category =
IF([Months since last Vac] <13,
“Less than 12 months”,
IF([Months since last Vac] >12 AND <25,
“Between 12 and 24 months”,
“Over 24 months”)
)
It doesnt like the text nor the AND.
Any help would be welcome.
Solved! Go to Solution.
Hi @steambucky
Welcome to the community 🙂
To solve your immediate problem, the syntax for the AND function is AND( <condition 1>, <condition 2> )
Also, it's always best to use preface a column with its table name i.e. TableName[ColumnName], so that columns aren't confused with measures.
So you could write something like this (replace TableName with your actual table name):
Vac Category = IF ( TableName[Months since last Vac] < 13, "Less than 12 months", IF ( AND ( TableName[Months since last Vac] > 12, TableName[Months since last Vac] < 25 ), "Between 12 and 24 months", "Over 24 months" ) )
Another suggestion for a more general solution:
https://www.daxpatterns.com/static-segmentation/
All the best,
Owen 🙂
Hi @steambucky
Welcome to the community 🙂
To solve your immediate problem, the syntax for the AND function is AND( <condition 1>, <condition 2> )
Also, it's always best to use preface a column with its table name i.e. TableName[ColumnName], so that columns aren't confused with measures.
So you could write something like this (replace TableName with your actual table name):
Vac Category = IF ( TableName[Months since last Vac] < 13, "Less than 12 months", IF ( AND ( TableName[Months since last Vac] > 12, TableName[Months since last Vac] < 25 ), "Between 12 and 24 months", "Over 24 months" ) )
Another suggestion for a more general solution:
https://www.daxpatterns.com/static-segmentation/
All the best,
Owen 🙂
You sir. are a legend. Thanks for the help 🙂
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
75 | |
73 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |