Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

At present that dax calculation is a simple SUM, but I need to default to the last non-blank value for the GrandTotal:

For example, instead of stating 167, it should not 9:

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
204 views
Welcome To Ask or Share your Answers For Others

1 Answer

Similar to the other question you asked, you can use HASONEVALUE to change the behavior of the Grand Total. If the column you are summing is named Table1[Value] then the measure you want will look something like this:

LastNonBlankValue = 
    VAR LastNonBlankDate = CALCULATE(MAX(DimDate[Date]), Table1[Value] > 0)
    RETURN IF(HASONEVALUE(DimDate[Date],
               SUM(Table1[Value]),
               CALCULATE(SUM(Table1[Value]),
                         ALLSELCTED(DimDate[Date]),
                         DimDate[Date] = LastNonBlankDate))

This is intended to find the last non-blank date, and sum over just that date for the Grand Total.

Since I don't know your table and column names or context, you'll need to modify this to suit your particular situation, but it should give you an idea of what to try.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...