Forum Discussion

netanel's avatar
netanel
Icon for Post Prodigy rankPost Prodigy
3 years ago
Solved

Show Zero only after the first value

Hi All!

 

 I want to display zeros on a day when there is no money,

this is my measure:

WithZero = COALESCE(SUM(fact_[_USD]), 0)

but when I use my formula, it shows me zeros from the beginning of the date. I want to see zeros only after the first money arrives.

 

When I place one of the value columns on a graph with the x-axis being the timeline, I get 0 from the beginning of the timeline.
I want to get 0 but only after the first value arrives.
For example, if there is a value in 2023/04/01 , then only from 2023/04/01 I want to receive data including 0

  • Hi netanel - Create a measure to find the first date with a non-zero value

    FirstNonZeroDate =
    CALCULATE(
    MIN(fact_[Date]),
    fact_[_USD] <> 0
    )

    use the above measure to display values including zeros after first date

    WithZeroAfterFirstValue =
    VAR FirstDate = [FirstNonZeroDate]
    RETURN
    IF(
    MIN(fact_[Date]) >= FirstDate,
    COALESCE(SUM(fact_[_USD]), 0),
    BLANK()
    )

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

1 Reply

  • Hi netanel - Create a measure to find the first date with a non-zero value

    FirstNonZeroDate =
    CALCULATE(
    MIN(fact_[Date]),
    fact_[_USD] <> 0
    )

    use the above measure to display values including zeros after first date

    WithZeroAfterFirstValue =
    VAR FirstDate = [FirstNonZeroDate]
    RETURN
    IF(
    MIN(fact_[Date]) >= FirstDate,
    COALESCE(SUM(fact_[_USD]), 0),
    BLANK()
    )

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!