Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

SAMEPERIODLASTYEAR() only total at the bottom

I only get total of the SAMEPERIOD LAST YEAR at the bottom. I can not get numbers by months. Any ideas?

 

  • Hi Anonymous 

    You could add a Date table into your model, and create a relationship between Date[Date] and Klant[Date] columns (one-to-many & single direction). Then use Date table's columns in Time Intelligence functions and Table visuals. When you use Date columns from Other tables, you may get blank values because of the filter context in a visual.

    For example,

    Sales LY = CALCULATE(SUM('Table'[Sales]),SAMEPERIODLASTYEAR('Table'[Date]))
    Sales LY modified = CALCULATE(SUM('Table'[Sales]),SAMEPERIODLASTYEAR('Date'[Date]))

    See difference of the results:

     
    Community Support Team _ Jing Zhang
    If this post helps, please consider Accept it as the solution to help other members find it.

2 Replies

  • edhans's avatar
    edhans
    Icon for Community Champion rankCommunity Champion

    Klant[Sample_Date] doesn't look like a date table to me. You need to use the Date[Date] field (or whatever you name it) from the true date table, not a date field from one of the other tables. 

     

    I'd need to see your model, or better yet your PBIX file, but I suspect this is a modeling issue. The Time Intelligence functions work over date tables, not any date field.

  • v-jingzhang's avatar
    v-jingzhang
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

    You could add a Date table into your model, and create a relationship between Date[Date] and Klant[Date] columns (one-to-many & single direction). Then use Date table's columns in Time Intelligence functions and Table visuals. When you use Date columns from Other tables, you may get blank values because of the filter context in a visual.

    For example,

    Sales LY = CALCULATE(SUM('Table'[Sales]),SAMEPERIODLASTYEAR('Table'[Date]))
    Sales LY modified = CALCULATE(SUM('Table'[Sales]),SAMEPERIODLASTYEAR('Date'[Date]))

    See difference of the results:

     
    Community Support Team _ Jing Zhang
    If this post helps, please consider Accept it as the solution to help other members find it.