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
Anonymous
Not applicable

Filter with measure as default value

Hello all

 

I have a report with several filters. One of the filters is for a specific date. For example the data-source contains the dates 5.10.2018, 6.10.2018, 7.10.2018, 8.10.2018

The user has to select the latest date, in this case 8.10.2018. Its always yesterday.

I created a measure to get this date.

But i cant find out how i can set this value as a default value for the filter. I tried the «Smart Filter by OKViz» and the original filter by Power BI.

Is this possible, or do anyone has another idea that would get me the expected result?

Unbenannt.PNG

 

1 ACCEPTED SOLUTION

The date slicer shows the value unselected, but selecting it after selecting the flag slicer doesn't add any filter to your report (it is already filtered!)

I understand it would look neater if the date was selected, but it is not something you can achieve I am afraid.

 

View solution in original post

9 REPLIES 9
aletib
Helper I
Helper I

What though if we're using a live connection and can't create additional columns?

v-danhe-msft
Employee
Employee

Hi @Anonymous,

Based on my research, the measure could not be used in the slicer, you could refer to Arentir's solution to solve your problem.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Arentir
Resolver III
Resolver III

Hi @Anonymous

 

It won't work as a measure, you should have a new column in your date table to identify latest date ("Y" / "N" for instance). Then you can use that as a filte.

 

A good article on the subject:

https://www.fourmoo.com/2018/09/11/power-bi-default-slicer-selection/

 

Anonymous
Not applicable

Correct me if im wrong, but as far as i understand this, it will always be the specified value. In my case, this should just work as a default value, it has to be still possible to select another date.

Forgot to say this in my post.

 

EDIT:

I read your post again and i misunderstood it, but its still impossible this way. I cant change the data-source.

I made a column over power bi with the "yesterday" value.

I don't think there is a way to just default, hence why I would use a "Latest Date" Flag, for instance in a slicer. You can click/unclick this slicer to see all dates.

You don't need to change the datasource, you can create a calculated column

Anonymous
Not applicable

Hello @Arentir

Thank you for your answer. So far, i didnt manage to get it to work.

I dont know if i understand you correctly:

I have a slicer(?) with all dates available in the column. I already ordered it desc so the latest date is the first one.

1.PNG

I tried to use a calculated column with the [Yesterdays Date] value but dont know how to apply it properly.

I also tried to figure out what you mean with a latest day flag column, as a own column it basically would only have one row or not? (9.10.2018)

 

 

I hope you see what i mean.

Thank you and kind regards

Hi @Anonymous,

 

See the PBI example attached, I have a calendar table and added two columns: one for latest date in the table and one for yesterday

 

See how the Flag slicer change your date slicer. Let me know if it works for you

 

https://1drv.ms/u/s!As5oZCclkGkWgSqo1vvqL-qtMxif

 

Anonymous
Not applicable

Hello @Arentir

 

Thanks for your file.

I had a look at it and understood it.

I built it into my existing report.

When i check the "use yesterday" filter it removes all other dates, but the user still has to select it in the dropdown.

I have to use the dropdown as there can be many entries if the user selects "no"

Is it possible that the dropdown selects the entry if only 1 is available? Or is this the limit?

Unbenannt.PNG

The date slicer shows the value unselected, but selecting it after selecting the flag slicer doesn't add any filter to your report (it is already filtered!)

I understand it would look neater if the date was selected, but it is not something you can achieve I am afraid.

 

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.