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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
LadaA
Frequent Visitor

Greater than or less than Slicer

Hi everyone,

 

The data I am working with is in the format of "Start Date" and "End Date". Is there any way that I could make it so that I have a slicer ranging from say 2015-2030 and if the slicer is set to 2023 it will show the data of all the projects that will be active that year.

 

Example of Data:

PlantPlant NameProduct TypeStart DateEnd DateAnnual LB Produced
1AFruit1/11/2019  11/1/2036   47563
2BMeat1/1/20196/1/2023 22128
3CFruit11/1/202311/1/2035 97860
4DVegies1/1/202512/1/2034 24650
5EGrain4/1/20241/1/2037 272804
6FMeat11/1/20226/1/2023 36542

 

In the case mentioned above where the slicer is set 2023 any data mapped to Plants 1,2,3 and 6 would be visable.

 

Any help would be greatly appreciated and thank you in advance for your time!

1 ACCEPTED SOLUTION
barritown
Super User
Super User

Hi @LadaA,

If you have a relatively small dataset, you can create an extended table like the one below and use the newly added column in it for filtering. If you deal with big data, you'll need another, less gready solution.

barritown_0-1687257818510.png

In plain text:

Extended Data = 
FILTER (
    CROSSJOIN ( 
        data,
        GENERATESERIES ( YEAR ( MIN ( data[Start Date] ) ), YEAR ( MAX ( data[End Date] ) ), 1 ) ),
    [Value] >= YEAR ( [Start Date]) && [Value] <= YEAR ( [End Date] ) ) 

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

View solution in original post

3 REPLIES 3
devanshi
Helper V
Helper V

General = FILTER(
                        AND( GENERATESERIES(YEAR(MIN([StartDate]), YAER(MAX[ENDDATE])),
                                   YEAR([StartDate)<=YEAR([EndDate])
                                   )
                       )

barritown
Super User
Super User

Hi @LadaA,

If you have a relatively small dataset, you can create an extended table like the one below and use the newly added column in it for filtering. If you deal with big data, you'll need another, less gready solution.

barritown_0-1687257818510.png

In plain text:

Extended Data = 
FILTER (
    CROSSJOIN ( 
        data,
        GENERATESERIES ( YEAR ( MIN ( data[Start Date] ) ), YEAR ( MAX ( data[End Date] ) ), 1 ) ),
    [Value] >= YEAR ( [Start Date]) && [Value] <= YEAR ( [End Date] ) ) 

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

Thank you @barritown ,

 

Thankfully my dataset is pretty small so this worked wonders!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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