Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Need to filter the same query 2 different ways, do I need 2 queries?

I have a log that has a created date and a closed date. I have 2 bar charts, log closed by month and log created by month.  I want to limit each of these to the last 12 months for the relevant dat...
  • ray_aramburo's avatar
    1 year ago

    Hi Anonymous , I suggest you these simple steps

    1) Have/create a Calendar/Date table in case you don't have it

    2) Create an active relationship between Date and Creaded Date

    3) Create an inactive relationship between Date and Closed Date

    4) Create 2 measures:

    ValueForCreatedDate = CALCULATE([SumOrValueMeasure], USERELATIONSHIP('Calendar'[Date], 'ValuesTable'[CreatedDate]))
    ValueForClosedDate = CALCULATE([SumOrValueMeasure], USERELATIONSHIP('Calendar'[Date], 'ValuesTable'[ClosedDate]))

    5) Use the date from the Calendar table as the slicer and your measures as your values 🙂