Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
bonjourposte
Helper V
Helper V

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
bonjourposte
Helper V
Helper V

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
    )

View solution in original post

3 REPLIES 3
bonjourposte
Helper V
Helper V

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
    )
Ritaf1983
Super User
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])
Ritaf1983_0-1722219562057.png

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]
)
Ritaf1983_1-1722219615117.png

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
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Shravan133
Super User
Super User

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
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.