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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to add the Selected date filter to a DAX formula.

Hi All,

 

I'm currently working on a project that looks at the customer satisfaction rate.

 

abdalahmed_1-1640343986273.png

The KPI card in blue currently has the following DAX formula:

 

M_Sum_Positive = DIVIDE(SUMX(FILTER(sentimental_value, sentimental_value[Sentiment]=5),sentimental_value[Occurances]),(SUM(sentimental_value[Occurances])))+0

 

The issue I am facing is that when the data parameter is adjusted on the top right of the dashboard. The KPI figures remain the same and do not adjust accordingly.

 

Q) How would I amend the DAX formula so that it takes into consideration the date parameters too

 

My calender table is:

abdalahmed_0-1640343925946.png

 

Thank you in advance

 

2 REPLIES 2
Anonymous
Not applicable

Hi @amitchandak 

 

Your solution that you provided is displaying an error; 

 

A function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

 

Ive tried to amend to error myself but have not had any luck

amitchandak
Super User
Super User

@Anonymous , is lkp_calendar joined with any column of sentimental_value

 

then it should filter. Else add condition

 

M_Sum_Positive = 
var _max = maxx(allselected(lkp_calendar ),lkp_calendar [Date])
var _min = minx(allselected(lkp_calendar ),lkp_calendar [Date])
return 
calculate( DIVIDE(SUMX(FILTER(sentimental_value, sentimental_value[Sentiment]=5),sentimental_value[Occurances]),(SUM(sentimental_value[Occurances])))
, filter( sentimental_value, sentimental_value[Date] >=_min  && sentimental_value, sentimental_value[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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors