Forum Discussion

smithmc3's avatar
smithmc3
Advocate I
8 years ago
Solved

Year to Date Chart

So do you all know how to make it so that the actual only shows through the current month?  See below, top chart is the publication and the bottom on is the powerbi chart?  I put the code for how we calculate actual and planned.  Target is calculated the same as planned and the multipled by .77

 

 

 

Actual = 
CALCULATE(
	SUM ('Months'[ActualPlanned]),
	FILTER(
		ALLSELECTED('Months'[Title]),
		ISONORAFTER('Months'[Title], MAX('Months'[Title]), DESC)
	)
)

 

 

 

Planned = 
CALCULATE(
	SUM ('Months'[AllPlanned]),
	FILTER(
		ALLSELECTED('Months'[Title]),
		ISONORAFTER('Months'[Title], MAX('Months'[Title]), DESC)
	)
)

 

 

 

  • smithmc3

    So you'd like the actual measure shows as in the top chart? I mean the red line shows blank after Sep instead of a horizontal line? If so, you could try

     

    Actual =
    VAR val =
        CALCULATE (
            SUM ( 'Months'[ActualPlanned] ),
            FILTER (
                ALLSELECTED ( 'Months'[Title] ),
                ISONORAFTER ( 'Months'[Title], MAX ( 'Months'[Title] ), DESC )
            )
        )
    RETURN
        IF ( MAX ( 'Months'[Title] ) <= TODAY (), val, BLANK () )

    If this is not your case, could you post any sample data? Do mask sensitive data before posting.

1 Reply

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    smithmc3

    So you'd like the actual measure shows as in the top chart? I mean the red line shows blank after Sep instead of a horizontal line? If so, you could try

     

    Actual =
    VAR val =
        CALCULATE (
            SUM ( 'Months'[ActualPlanned] ),
            FILTER (
                ALLSELECTED ( 'Months'[Title] ),
                ISONORAFTER ( 'Months'[Title], MAX ( 'Months'[Title] ), DESC )
            )
        )
    RETURN
        IF ( MAX ( 'Months'[Title] ) <= TODAY (), val, BLANK () )

    If this is not your case, could you post any sample data? Do mask sensitive data before posting.