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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
danzrust
Helper IV
Helper IV

Date Filter with Overlapping Preselects (Today, Yesterday, Last 7 Days, Last 30 Days, Last Month...)

I am looking for hints on how to replicate these filter preselects in Power BI:

 
danzrust_0-1663494524446.png

 

 

I want to to simply create this as a dropdown filter with no other extra steps for my users. Assume my users are 100% lame and they can only understand a simple drodown. 

 

I was searching for a solution but I could not find any. I am very suprised I could not find anything because this is a very common request from business users.

 

My data model has a standalone calendar table. 

 

Any ideas? Is this even possible?

 

 

4 REPLIES 4
danzrust
Helper IV
Helper IV

@mahoneypat 
Okay, I get the idea and it's pretty slick. But I need a little push on the DAX side of things. 

My use case is that I just need to use the calculation group items as filter option in a slicer. I have an existing calendar table which tells me what date is e.g. "yesterday", "last week", "this month", "last month" etc. 

I've created my group but it "does not work" (pretty sure, you hear this quote quite often).

Here is my situation:

danzrust_0-1663880805940.png


All the other calculation items are created in a similar fashion.

 

You can see that I'm using the group item in the slicer, yet the table with my performance stats does not get filtered based on my slicer selection.

I've noticed that only calculated measures (which I also have in my model) would get filtered in my table based on the selection in the slicer, not the ones which are coming straight from the raw data. In my example, the "Impr" in the table is coming straight from the raw data. It's not a "measure" created via DAX. I am just downloading data from BigQuery via Query Editor.

 

Any hints? 🙂
 

In your calculation item expression try using this instead

 

CALCULATE(SELECTEDMEASURE(), ALL('Calendar'), 'Calendar'[Last X Weeks] = "Current week")

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi Pat,
I've gone ahead and created standalone aggregated metrics so I could use them in the calculation groups. There are some other indirect benefits of having these agg metrics ready to go anyway 🙂

Thanks for your help!

mahoneypat
Employee
Employee

You can do that with a Calculation Group. Just create a calculation item for each pre-set date range you want, and then you can use the calculation item name column in your slicer. You will need Tabular Editor to create it, but there is a free version if you are not already using it.

 

Creating Calculation Groups in Power BI Desktop - SQLBI

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors