The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I've got a column of about 20 people and their birthdays, and I'm creating a DAX measure specifically for the nieces and nephews who will get money for their birthday. Every birthday, they will get $5 plus their age.
I'm trying to say, IF [person] = "tanya", "bobby", "sarah", "troy", then [Current Age] + $5. How do you write that in DAX? Is that a switch statement?
Thanks!
Solved! Go to Solution.
Thanks so much for your responses, guys. I ended up using a SWITCH statement:
Thanks so much for your responses, guys. I ended up using a SWITCH statement:
Hi @bonjourposte
If the goal is a calculated column you can use this formula :
If you need the measure :
Pbix with the example is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
try this:
Birthday Amount =
VAR PersonList = {"tanya", "bobby", "sarah", "troy"}
VAR CurrentAge = [Current Age] -- Replace [Current Age] with your actual column name
RETURN
IF (
[Person] IN PersonList,
CurrentAge + 5,
BLANK() -- This will return blank if the person is not in the list
)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
122 | |
89 | |
75 | |
55 | |
45 |
User | Count |
---|---|
135 | |
121 | |
77 | |
65 | |
64 |