cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Regular Visitor

## How to get data range from slicer

Good day

I need to calculate the days between the data range of a slicer. I've been using the ALLSELECTED function but i noticed that the value it gets me is from the table that is linked to the slicer, not the slicer itself. So when i use another slicer that's linked to the same table, it gets me two values

For example, in this picture, the date slicer goes from 10/1/2022 to 12/15/2022 and the last date in the table is 12/15/2022 (as you can see in the card). But if i change the slicer in left (The Status), it automatically changes the date according to the last date in the table (as you can see in the card, image below), but is not the same date of the max range of the slicer.

As i said before, what i need is the min and max range of the date slicer (in this case 10/1/2022 - 12/15/2022) regardless of the data on the table

Kind regards

6 REPLIES 6
Memorable Member

Hello, make sure your slicer you have there is filtering the card and that the measure is using the same table as used in the slicer

// if this is a solution please mark as such. Kudos always appreciated.
Regular Visitor

Thanks for answering in short notice. I've checked in the interactions and the card is being filtered by the date slicer but still is not showing the values it should. The only thing i changed of your formula is that i'm using the .[Date] cause it was showing an error

Memorable Member

Hello, make this measure. It will just pickup the min and max date from the slicer:

DayDiff =
var _min=FIRSTDATE(Query1[Raised_date])
var _max=LASTDATE(Query1[Raised_date])
return
DATEDIFF(_min,_max,DAY)

Cheers
// if this is a solution please mark as such. Kudos always appreciated.
Regular Visitor

This one looks good but it gives me the whole number of days since the table was created, the table starts on 1/31/2016 and ends today 12/19/2022 so the result is 2556 days, that means is ignoring the slicer filter

Memorable Member

You could do this a bunch of ways. prob the easiest is to make a text box and use the values functionality to do some like:

This report covers the period min_date to max_date

If you havent done this before heres the MS page on how to do it:

Add text boxes, shapes, and smart narrative visuals to Power BI reports - Power BI | Microsoft Learn

Hope this helps,

Cheers,

// if this is a solution please mark as such. Kudos always appreciated.
Regular Visitor

The thing is that i need the values for a measure, and it has to be the same values in the date slicer regardless of the filter in the status slicer. If i select the dates from 10/1/2022 to 12/15/2022, it should count 14 days whether the status slicer is in "ABORTED" or not

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors