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

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.

Reply
Anonymous
Not applicable

Help with displaying value if there is no ones birtday today

Hi, im making a birtday dashboard for my company.

 

I think ive gotten it to work. My only issue is that if there is no birthday today the displayed information is just "has birthday today!".

I'd love to make it so the text displays "No one has birthday today" when there is no birthday at todays date.

 

This is how the text looks when there is no birthday that day:

Snag_a6fca8.png

 

 

Here is the DAX, some of the text is in Norwegian:

 

Hvem har bursdag i dag? = VAR next = MINX(
    FILTER(
        Ark1,
        MONTH(Ark1[NesteBursdag]) = MONTH(TODAY()) &&
        DAY(Ark1[NesteBursdag]) = DAY(TODAY())
    ),
    CALCULATE(
        DATE(
            YEAR(TODAY()),
            MONTH(MIN(Ark1[NesteBursdag])),
            DAY(MIN(Ark1[NesteBursdag]))
        )
    )
)
RETURN CONCATENATEX(
    FILTER(
        Ark1,
        MONTH(Ark1[NesteBursdag]) = MONTH(next) &&
        DAY(Ark1[NesteBursdag]) = DAY(next)
    ),
    FIRSTNONBLANK(Ark1[Navn], 1),
    " & "
) & " har bursdag!"
 
 
Thanks 🙂
1 ACCEPTED SOLUTION

Hey @Anonymous try this:
Not sure if _result return blank when there are no birthdays, so if not I'll change the code a little bit

Whos birthday is it today? =
VAR next =
    MINX (
        FILTER (
            Table1,
            MONTH ( Table1[Nextbirthday] ) = MONTH ( TODAY () )
                && DAY ( Table1[Nextbirthday] ) = DAY ( TODAY () )
        ),
        CALCULATE (
            DATE ( YEAR ( TODAY () ), MONTH ( MIN ( Ark1[Nextbirthday] ) ), DAY ( MIN ( Ark1[Nextbirthday] ) ) )
        )
    )
VAR _result =
    CONCATENATEX (
        FILTER (
            Table1,
            MONTH ( Table1[Nextbirthday] ) = MONTH ( next )
                && DAY ( Ark1[Nextbirthday] ) = DAY ( next )
        ),
        FIRSTNONBLANK ( Table1[Name], 1 ),
        " & "
    )
RETURN
    IF (
        NOT ISBLANK ( _result ),
        _result & " has their birthday today!",
        "No one has birthday today"
    )

 

View solution in original post

5 REPLIES 5
Aditya_Meshram
Solution Supplier
Solution Supplier

Hi @Anonymous ,
I ithink they meant like this. Try it :

Hvem har bursdag i dag? = VAR next = MINX(
    FILTER(
        Ark1,
        MONTH(Ark1[NesteBursdag]) = MONTH(TODAY()) &&
        DAY(Ark1[NesteBursdag]) = DAY(TODAY())
    ),
    CALCULATE(
        DATE(
            YEAR(TODAY()),
            MONTH(MIN(Ark1[NesteBursdag])),
            DAY(MIN(Ark1[NesteBursdag]))
        )
    )
)
var _result = CONCATENATEX(
    FILTER(
        Ark1,
        MONTH(Ark1[NesteBursdag]) = MONTH(next) &&
        DAY(Ark1[NesteBursdag]) = DAY(next)
    ),
    FIRSTNONBLANK(Ark1[Navn], 1),
    " & "
)
RETURN
IF(ISBLANK(_result),"No one has birthday today.",_result & " har bursdag!")



Regards

SpartaBI
Community Champion
Community Champion

@Anonymous 
Hey, hard with the language 🙂 but hopefully you can adjust this logic to your VAR/Measure names needed:
change the last RETURN to VAR named "result" and then:
RETURN
IF( NOT ISBLANK(Birthday), _result, "No one has birthday today")

Anonymous
Not applicable

Hi and thank you for the reply. Im pretty new to powerBI and DAX in general, so im not sure how i apply your answer into my code. Do you think you can elaborate or link me to a resource where i can understand it better?

Ive translated the code to english 🙂

Whos birthday is it today? =
VAR next = MINX(
    FILTER(
        Table1,
        MONTH(Table1[Nextbirthday]) = MONTH(TODAY()) &&
        DAY(Table1[Nextbirthday]) = DAY(TODAY())
    ),
    CALCULATE(
        DATE(
            YEAR(TODAY()),
            MONTH(MIN(Ark1[Nextbirthday])),
            DAY(MIN(Ark1[Nextbirthday]))
        )
    )
)
RETURN CONCATENATEX(
    FILTER(
        Table1,
        MONTH(Table1[Nextbirthday]) = MONTH(next) &&
        DAY(Ark1[Nextbirthday]) = DAY(next)
    ),
    FIRSTNONBLANK(Table1[Name], 1),
    " & "
) & " has their birthday today!"

Hey @Anonymous try this:
Not sure if _result return blank when there are no birthdays, so if not I'll change the code a little bit

Whos birthday is it today? =
VAR next =
    MINX (
        FILTER (
            Table1,
            MONTH ( Table1[Nextbirthday] ) = MONTH ( TODAY () )
                && DAY ( Table1[Nextbirthday] ) = DAY ( TODAY () )
        ),
        CALCULATE (
            DATE ( YEAR ( TODAY () ), MONTH ( MIN ( Ark1[Nextbirthday] ) ), DAY ( MIN ( Ark1[Nextbirthday] ) ) )
        )
    )
VAR _result =
    CONCATENATEX (
        FILTER (
            Table1,
            MONTH ( Table1[Nextbirthday] ) = MONTH ( next )
                && DAY ( Ark1[Nextbirthday] ) = DAY ( next )
        ),
        FIRSTNONBLANK ( Table1[Name], 1 ),
        " & "
    )
RETURN
    IF (
        NOT ISBLANK ( _result ),
        _result & " has their birthday today!",
        "No one has birthday today"
    )

 

Anonymous
Not applicable

Thanks! It worked like a charm!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors