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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
bonjourposte
Advocate III
Advocate III

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
Advocate III
Advocate III

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
Advocate III
Advocate III

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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