cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

How to use dateadd() with the selectedvalue from a date slicer without errors

I have matrix_2 where I want to take the date value from a slicer which filters matrix_1, and shows the values that is offset by -7 days.  So if showing values for Monday on matrix_1, I want matrix_2 to show values for the previous Monday.  

 

I am using dateadd(selectedvalue(table[transaction_date]), -7, day) but i am getting error: 

 

a function 'selectedvalue' has been used in a true/false expression that is used as a table filter expression. This is not allowed.  Hope someone can help. Thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Is Transaction Date the one in the slicer? DateAdd will accept the whole column, so you shouldn't need to use the SelectedValue function at all, but depends what else is going on with your relationships between matrix 2 data and transaction date.

 


______________


Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 


If you found this post helpful, please give Kudos.


I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 


excelwithallison.com

View solution in original post

4 REPLIES 4
Highlighted
Super User II
Super User II

Is Transaction Date the one in the slicer? DateAdd will accept the whole column, so you shouldn't need to use the SelectedValue function at all, but depends what else is going on with your relationships between matrix 2 data and transaction date.

 


______________


Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 


If you found this post helpful, please give Kudos.


I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 


excelwithallison.com

View solution in original post

Highlighted
Super User III
Super User III

Hi,

Ensure that you have a Calendar Table and the slicer has the Date column from this Calendar table.  This measure should work

=min(calendar[date])-7

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Highlighted

@AllisonKennedy 

 

Wow didn't know you can do that without the selectedvalue function. It worked, unfortunately it didn't help me with what I wanted to do. But thanks, it will help me down the road.  

Highlighted

@wpf_ Glad you learned something new at least. Post a new question with some sample data and desired output and we can keep helping you get the final result you need.

 


______________


Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 


If you found this post helpful, please give Kudos.


I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 


excelwithallison.com

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors