Forum Discussion

jhd's avatar
jhd
Helper I
8 years ago

Date filter having unexpected effect

I have the measure: GBPPRICE_END_FY-1=

 


VAR LASTSALE =
   CALCULATE (
       MAX ( 'Table1'[DATE_REC] ),
       PREVIOUSYEAR ( 'Calendar'[Date], "3/31" ),
       ALL ( Table1[SUPPLIER_GROUP] )
   )
RETURN
    IF (
        Table1[Sum of UNITS_REC] > 0,
        CALCULATE ( [GBPAVGPRICE], ALLSELECTED ( Table1 ), Table1[DATE_REC] = LASTSALE ),
        BLANK ()
    )

           

 

It should show the last price achieved in the previous financial year, and it works, but only if I have my pivot table contains the previous financial year. If I only select the current financial year, the values disappear.

Do I need to all something else to the ALL function? My attempts have so far failed.

Thanks, James

2 Replies

  • Hi,

     

    Does this work?

     

    =CALCULATE(MAX('Table1'[DATE_REC]),PREVIOUSYEAR('Calendar'[Date])

     

    Drag years to the row/column area of the Table/Matrix visual.

     

    If this does not work, then share the link from where i can download your PBI file.

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi jhd,

     

    Could you please mark the proper answers as solutions?

     

    Best Regards,

    Dale