cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

## Singling out certain text values in dax- birthday money

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!

1 ACCEPTED SOLUTION

Thanks so much for your responses, guys.  I ended up using a SWITCH statement:

Birthday Money =
SWITCH(
MAX(
'Important Birthdays'[Person]),
"Tanya", MAXX('Important Birthdays',[AgeToBeThisYear]) + 5,
"Bobby", MAXX('Important Birthdays', [AgeToBeThisYear]) +5,
"Sarah", MAXX('Important Birthdays', [AgeToBeThisYear]) +5,
"Troy", MAXX('Important Birthdays', [AgeToBeThisYear]) +5,
0
)
3 REPLIES 3

Thanks so much for your responses, guys.  I ended up using a SWITCH statement:

Birthday Money =
SWITCH(
MAX(
'Important Birthdays'[Person]),
"Tanya", MAXX('Important Birthdays',[AgeToBeThisYear]) + 5,
"Bobby", MAXX('Important Birthdays', [AgeToBeThisYear]) +5,
"Sarah", MAXX('Important Birthdays', [AgeToBeThisYear]) +5,
"Troy", MAXX('Important Birthdays', [AgeToBeThisYear]) +5,
0
)
Super User

Hi @bonjourposte
If the goal is a calculated column you can use this formula :

Column = IF([name] in {"tanya", "bobby", "sarah", "troy"},[age]+5,[age])

If you need the measure :

Measure_ =
SUMX(
SUMMARIZE(
'Table',
'Table'[name],
"Sum",
IF(
'Table'[name] IN {"tanya", "bobby", "sarah", "troy"},
SUM('Table'[age]) + 5,
SUM('Table'[age])
)
),
[Sum]
)

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

Regards,
Rita Fainshtein | Microsoft MVP
Solution Sage

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
)

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

#### Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors