Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Issue with Last N Months

I have data for last 2 months of a year 2018.I have created all the necessary measures and columns as well as tables following this tutorial http://sqljason.com/2018/03/display-last-n-months-selected-month-using-single-date-dimension-in-power-bi.html.This is my dashboard.

but when i am choosing the date as August 2018 and selecting the slider to show the data for last 2( or any number) months then i am not getting the required result. This is the measure i am using 

 

Scan (last n months) = 
CALCULATE (
    COUNT('Scan'[Data ID]),
    DATESINPERIOD ('Date'[Date],MAX('Date'[Date]),-[N Value],MONTH )
)

 

 

No data for previous months for August 2018

No data for previous months of August 2018

3 Replies

  • v-lid-msft's avatar
    v-lid-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    We think the problem may be with the filed used in slicer.

    Please try using ‘Date’ table’s [monthyear] to create a slicer.

    Here is an simple,

     

     

    Before this, we need to create a relationship between date table and Scan table.

     

     

    If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?


    Best regards,