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
vanessafvg
Super User
Super User

Blank handling in banding

i have this switch statement below

 

hoever when i have blank values it groups it into the 0-4 weeks, is blank seen as 0 and why is it doing this?   sure blank shoudl be ignored by the banding? or all into n/a?

 

Weeks since last seen by GP/NMP Banding =
SWITCH (
TRUE (),
AND (
Substance[Weeks since last seen by GP/NMP] >= 0,
Substance[Weeks since last seen by GP/NMP] <= 4
), "0-4 weeks",
AND (
Substance[Weeks since last seen by GP/NMP] > 4,
Substance[Weeks since last seen by GP/NMP] <= 8
), "4-8 weeks",
AND (
Substance[Weeks since last seen by GP/NMP] > 8,
Substance[Weeks since last seen by GP/NMP] <= 12
), "8-12 weeks",
Substance[Weeks since last seen by GP/NMP]> 12,
"12+ weeks",
"n/a"
)





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




1 ACCEPTED SOLUTION

In DAX, BLANK equals zero.

If you want a special treatment, add an ISBLANK ( yourcolumn ) as the first test, so to avoid further processing of the conditions.
Have fun with DAX!

Alberto Ferrari
http://www.sqlbi.com

 

Alberto Ferrari - SQLBI

View solution in original post

3 REPLIES 3
v-yulgu-msft
Employee
Employee

Hi @vanessafvg,

 

Agree with AlbertoFerrari's suggestion, I made some adjustment in original formula:

Weeks since last seen by GP/NMP Banding 2 =
IF (
    ISBLANK ( Substance[Weeks since last seen by GP/NMP] ),
    "n/a",
    SWITCH (
        TRUE (),
        AND (
            Substance[Weeks since last seen by GP/NMP] >= 0,
            Substance[Weeks since last seen by GP/NMP] <= 4
        ), "0-4 weeks",
        AND (
            Substance[Weeks since last seen by GP/NMP] > 4,
            Substance[Weeks since last seen by GP/NMP] <= 8
        ), "4-8 weeks",
        AND (
            Substance[Weeks since last seen by GP/NMP] > 8,
            Substance[Weeks since last seen by GP/NMP] <= 12
        ), "8-12 weeks",
        Substance[Weeks since last seen by GP/NMP] > 12, "12+ weeks",
        "n/a"
    )
)

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

In DAX, BLANK equals zero.

If you want a special treatment, add an ISBLANK ( yourcolumn ) as the first test, so to avoid further processing of the conditions.
Have fun with DAX!

Alberto Ferrari
http://www.sqlbi.com

 

Alberto Ferrari - SQLBI

@AlbertoFerrari grazie!





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.