Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

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 date, closed for the closed chart and created for the created chart. 

 

When I put a filter on it filters both charts by the date selected, either created or closed. That creates a problem for the closed log as it will filter out log items that were created more than 12 months ago even if they were not closed until the last 12 months.

 

Other than duplicating the query, what options do I have?

1 ACCEPTED SOLUTION
ray_aramburo
Super User
Super User

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 🙂

 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

See if my solution in the attached PBI file works.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ray_aramburo
Super User
Super User

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 🙂

 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





lbendlin
Super User
Super User

Create a second, inactive relationship from the calendar date to the close date. Create a second measure with USERELATIONSHIP.  Then you can show both in the same date range.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.