Skip to main content
cancel
Showing results for 
Search instead 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

Reply
NewbieJono
Post Patron
Post Patron

Return 0 if blank

hello all, prob an easy one for someone, how can i get this code to return 0 if blank

 

NEW RAG = 
VAR __workStream = 'FACT - Backlog'[Grouping]
VAR __daysOld = 'FACT - Backlog'[Days Old]
RETURN
CALCULATE ( 
    MAX ( 'RAG MATRIX (TESTING)'[RAG] ),
    'RAG MATRIX (TESTING)'[Workstream] = __workStream,
    __daysOld >= 'RAG MATRIX (TESTING)'[Min Range],
    __daysOld <= 'RAG MATRIX (TESTING)'[Max Range]
)
1 ACCEPTED SOLUTION

Hi @NewbieJono ,

Please modify the formula like this:

NEW RAG =
VAR __workStream = 'FACT - Backlog'[Grouping]
VAR __daysOld = 'FACT - Backlog'[Days Old]
RETURN
    CALCULATE (
        MAX ( 'RAG MATRIX (TESTING)'[RAG] ),
        'RAG MATRIX (TESTING)'[Workstream] = __workStream,
        __daysOld >= 'RAG MATRIX (TESTING)'[Min Range],
        __daysOld <= 'RAG MATRIX (TESTING)'[Max Range]
    ) + 0

Or like this:

NEW RAG =
VAR __workStream = 'FACT - Backlog'[Grouping]
VAR __daysOld = 'FACT - Backlog'[Days Old]
VAR __result =
    CALCULATE (
        MAX ( 'RAG MATRIX (TESTING)'[RAG] ),
        'RAG MATRIX (TESTING)'[Workstream] = __workStream,
        __daysOld >= 'RAG MATRIX (TESTING)'[Min Range],
        __daysOld <= 'RAG MATRIX (TESTING)'[Max Range]
    )
RETURN
    IF ( __result = BLANK (), 0, __result )

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
PaulDBrown
Community Champion
Community Champion

Either add + 0 at the end of the measure or:

0 for blanks = COALESCE ([NEW RAG] , 0)





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






sorry at which point do i put the 0 ?

 

which is the preferred method ?

Hi @NewbieJono ,

Please modify the formula like this:

NEW RAG =
VAR __workStream = 'FACT - Backlog'[Grouping]
VAR __daysOld = 'FACT - Backlog'[Days Old]
RETURN
    CALCULATE (
        MAX ( 'RAG MATRIX (TESTING)'[RAG] ),
        'RAG MATRIX (TESTING)'[Workstream] = __workStream,
        __daysOld >= 'RAG MATRIX (TESTING)'[Min Range],
        __daysOld <= 'RAG MATRIX (TESTING)'[Max Range]
    ) + 0

Or like this:

NEW RAG =
VAR __workStream = 'FACT - Backlog'[Grouping]
VAR __daysOld = 'FACT - Backlog'[Days Old]
VAR __result =
    CALCULATE (
        MAX ( 'RAG MATRIX (TESTING)'[RAG] ),
        'RAG MATRIX (TESTING)'[Workstream] = __workStream,
        __daysOld >= 'RAG MATRIX (TESTING)'[Min Range],
        __daysOld <= 'RAG MATRIX (TESTING)'[Max Range]
    )
RETURN
    IF ( __result = BLANK (), 0, __result )

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

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 Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.