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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Rk_1411
Frequent Visitor

Selected value from the slicer comparison with a Table value

Hi,

 

I am in need to get the selected value from the slicer which is showing Month Year. I am acheiving this by creating a measure and using selectedValue(). I am not sure what is the datatype of this measure.

My issue is i need to compare this value with a date field and create a new column if the data matches. I have tried all the options but somehow the comaprison is alwyas resulting in a no.

I created a column and then formateed the date field as Month and year and then compared with the selected value field but it doesnt work.

Can anyone suggest how to achieve this.

3 REPLIES 3
Rk_1411
Frequent Visitor

I tried it but Somehow the Caclculate is not working. Here is what i tried..

CALCULATE(COUNTROWS(vwSafetyContacts),FILTER(vwSafetyContacts,FORMAT(vwSafetyContacts[Submitted],"mmm-yyyy") = vwSafetyContacts[Sel Value])) 

 

I do not have any other measure in my table to sum .. The problem I am seeing in the comaprison is that it works for some rows and not for other. 

 

Anonymous
Not applicable

Hi @Rk_1411 ,

In order to provide you a suitable solution, could you please share some sample data in your table vwSafetyContacts (exclude sensitive data) with Text format and your expected result with backend logic and special examples. By the way, [Sel Value] is a measure or a fact field in the table? If it is a measure, please provide its formula.  It is better if you can share a simplified pbix file. Thank you.

How to upload PBI in Community

Best Regards

amitchandak
Super User
Super User

@Rk_1411 , You can create month year in date table 

 

Month Year = FORMAT([Date],"mmm-yyyy")
Month Year sort = FORMAT([Date],"yyyymm")

 

 

and use that

then this should work

new measure =
calculate( sum(Table[Value]), filter('Table', 'Table'[Month Year] = selectedvalue(Month Year)))

 

or

 

new measure =
 var _max = maxx(allselected(Date),Date[Date])
var _min = mainx(allselected(Date),Date[Date])
return 
calculate( sum(Table[Value]), filter('Table', 'Table'[Date] >=_min && 'Table'[Date] <=_max))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.