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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Trying to pull the day prior and day after values from a slicer. Is this possible?

I'm finished working on a currency exchange rate table based upon the day.

I have a date slicer (Currecny Exchange Rate_R [Date Slicer]) (I changed this to a text format so I could add the search option to the slicer) and it was requested that I add the day prior value and the day after vaule to the finished table.

The Values are (Currency Exchange Rate_R [AVG]) & (Currency Exchange Rate_R [SPOT])

I've tried some other things I found here but they are basically to do sums from the days prior. I'm just trying to grab the the prior day and day after values to add to the finished table. 

It seems like this should be possible, but I'm clueless....please help a fellow BI Dev! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you for the help, sadly these soultions didn't give me the results I was looking for. I ended up just duplicating my orginal table (There were only 9 rows) and created a second slicer. So now they can do quick comparison for any days they want instead of just the day before and after. 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thank you for the help, sadly these soultions didn't give me the results I was looking for. I ended up just duplicating my orginal table (There were only 9 rows) and created a second slicer. So now they can do quick comparison for any days they want instead of just the day before and after. 

v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can use the following measures to meet your requirement:

 

PreviousDay = 
VAR t =
    SELECTCOLUMNS ( ALL ( 'Table' ), "date", DATEVALUE ( [Date] ) )
VAR f =
    SELECTCOLUMNS ( FILTERS ( 'Table'[Date] ), "date-f", DATEVALUE ( [Date] ) )
RETURN
    MAXX ( FILTER ( t, [date] < MINX ( f, [date-f] ) ), [date] )
AfterDay = 
VAR t =
    SELECTCOLUMNS ( ALL ( 'Table' ), "date", DATEVALUE ( [Date] ) )
VAR f =
    SELECTCOLUMNS ( FILTERS ( 'Table'[Date] ), "date-f", DATEVALUE ( [Date] ) )
RETURN
    MINX ( FILTER ( t, [date] > MAXX ( f, [date-f] ) ), [date] )

12.PNG13.PNG

 


If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Have you looked at LOOKUPVALUE function? If you have the date, you should be able to add one or subtract one and then use LOOKUPVALUE to return the value for that day.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.