cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
RobinwDNV
Frequent Visitor

Filters on DAX measure problem

Dear community, hopefully someone knows how to fix this seemingly simple issue that I can't figure out how to solve myself. 

I am creating measures that count the amount of employees that fit a certain set of criteria. 

one of them is 

NoPromotionGradeEntryDate =
CALCULATE(DISTINCTCOUNT('main data'[Person Number]);
'main data'[Promoted] = 0;
 'main data'[Grade Entry Date] < 04-01-2011) 
this returns blank. that is strange because if I put [person number] in a visual and apply the [promoted] and [grade entry date] as filters to the visual, it works fine. Also if i change to 'main data'[Grade Entry Date] > 04-01-2011 it also works. 
Does anyone know why "<" doesnt work, even though I definitely have a lot of rows that match the criteria, and ">" does work? 
Any input is welcome, thanks in advance!
Kind regards
1 ACCEPTED SOLUTION
RobinwDNV
Frequent Visitor

I found a workaround and now it works.  
the old formula is 

NoPromotionGradeEntryDate =
CALCULATE(DISTINCTCOUNT('main data'[Person Number]);
'main data'[Promoted] = 0;
 'main data'[Grade Entry Date] < 04-01-2011) 
 
I changed this to the new formula using DATE as a variable:
NoPromotionGradeEntryDate =
VAR _date = DATE(2011; 04; 01)

VAR _result = CALCULATE(DISTINCTCOUNT('main data'[Person Number]);
'main data'[Promoted] = 0;
 'main data'[Grade Entry Date] < _date)
RETURN _result
 
Hope this helps others with the same problem!

View solution in original post

5 REPLIES 5
RobinwDNV
Frequent Visitor

I found a workaround and now it works.  
the old formula is 

NoPromotionGradeEntryDate =
CALCULATE(DISTINCTCOUNT('main data'[Person Number]);
'main data'[Promoted] = 0;
 'main data'[Grade Entry Date] < 04-01-2011) 
 
I changed this to the new formula using DATE as a variable:
NoPromotionGradeEntryDate =
VAR _date = DATE(2011; 04; 01)

VAR _result = CALCULATE(DISTINCTCOUNT('main data'[Person Number]);
'main data'[Promoted] = 0;
 'main data'[Grade Entry Date] < _date)
RETURN _result
 
Hope this helps others with the same problem!
WaqarArshad
Helper I
Helper I

Hi, its asking for sign in 

Hi, Im sorry, i dont find a way to send or attach the PBI file to this post. but thank you for trying to help!

WaqarArshad
Helper I
Helper I

Can you check what format your date is in. Is it dd-mm-yyyy or mm-dd-yyyy. 

Sharing a sample file would also be helpful in diagnosing the issue

sample PBI I created a sample file I hope you can open it

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors