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
johnbasha33
Solution Sage
Solution Sage

Dynamic Slicers with 2 dates

Hi there esteemed community members.

 

i have a scenario as below
below is a sample data, i have share prices for Apple for different dates.

i duplicated date column as start date and end date.

i want to use these 2 dates as 2 slicers.

if user select start date and end date.

bottom table should display what is the share price of start date and end date in 2 columns.

basically i need 2 measures. 

 

i have been trying with calender table and different methods. it only works for start date, as soon as i select start date end date slicer unable to select.  any thoughts on this how to achieve ?

 

@amitchandak @lbendlin @mwegener @Jihwan_Kim @Arul 

CompanyShare PriceStart DateEnd DateDate
Apple$10.1/5/20241/5/20241/5/2024
Apple$15.5/5/20245/5/20245/5/2024
Apple$23.12/5/202412/5/202412/5/2024
Apple$25.5/15/20245/15/20245/15/2024
Apple$32.5/18/20245/18/20245/18/2024
2 ACCEPTED SOLUTIONS

Hi, @johnbasha33 

You need to drop one of the columns of end date or start date and store it in a table of calculations and put it into the slicer as shown in the following figure:

End day table = SUMMARIZE('Table','Table'[End Date])

hackcrr_0-1715425094228.png

hackcrr_1-1715425167502.png

hackcrr_2-1715425194412.png

I created the following two metrics:

share price of end date = 
VAR _end_day = SELECTEDVALUE('End day table'[End Date])
RETURN CALCULATE(SUM('Table'[Share Price]),FILTER(ALL('Table'),'Table'[End Date]=_end_day))
share price of start date = 
VAR _start_day = SELECTEDVALUE('Table'[Start Date])
RETURN CALCULATE(SUM('Table'[Share Price]),FILTER(
    ALL('Table'),
    'Table'[Start Date]=_start_day
)
)

I use both metrics in the table visual:

hackcrr_3-1715425292574.png

The results are as follows:

hackcrr_4-1715425335369.png

hackcrr_5-1715425349170.png

 

Best Regards,

hackcrr

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

GauravAher73
New Member

Hi,

 

You can unpivot Start date and end date columns, so you will get values column in which all dates will be stored ,
now you can use values column in between slicer and get share price from date range

GauravAher73_0-1715540748605.png

 

View solution in original post

8 REPLIES 8
GauravAher73
New Member

Hi,

 

You can unpivot Start date and end date columns, so you will get values column in which all dates will be stored ,
now you can use values column in between slicer and get share price from date range

GauravAher73_0-1715540748605.png

 

Hi @GauravAher73  this seems to be a working solution, i am surprised it is that simple. would you please share me the pbix for the same? i will review it and will mark it as solution. 

Arul
Super User
Super User

@johnbasha33 ,

Could give us an example of what do you need in your visual and in which visual?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Hi @Arul 

i am trying below, i want to see the start date price and end date price in a table. 

johnbasha33_0-1715151686754.png

 

@johnbasha33 ,

Do you want them in two visuals?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


@Arul no, in a single visual with 2 columns, share price of start date and share price of end date

Hi, @johnbasha33 

You need to drop one of the columns of end date or start date and store it in a table of calculations and put it into the slicer as shown in the following figure:

End day table = SUMMARIZE('Table','Table'[End Date])

hackcrr_0-1715425094228.png

hackcrr_1-1715425167502.png

hackcrr_2-1715425194412.png

I created the following two metrics:

share price of end date = 
VAR _end_day = SELECTEDVALUE('End day table'[End Date])
RETURN CALCULATE(SUM('Table'[Share Price]),FILTER(ALL('Table'),'Table'[End Date]=_end_day))
share price of start date = 
VAR _start_day = SELECTEDVALUE('Table'[Start Date])
RETURN CALCULATE(SUM('Table'[Share Price]),FILTER(
    ALL('Table'),
    'Table'[Start Date]=_start_day
)
)

I use both metrics in the table visual:

hackcrr_3-1715425292574.png

The results are as follows:

hackcrr_4-1715425335369.png

hackcrr_5-1715425349170.png

 

Best Regards,

hackcrr

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Hi @hackcrr  thanks for your time in looking into this, this seems to be a workable solution, let me review it a bit and will confirm. 

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.