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
pelucapampa
Helper I
Helper I

Measure and Date Filtered

Hi All

I've table with workers, this table have StartWorkDate, and in some cases EndWorkDate.

 

WorkerStartDate(dd/mm/yy)EndDate(dd/mm/yy)
Peter01/01/2018 
Jhon20/05/2018 
Sara03/02/201810/05/2018
Mark01/02/2018 

 

I need a measure with COUNT the quantity of employees are ACTIVES into a Selected Month (Relative Date Filter).

I try thay

 

 

LegActivos = 
var SelectDateMin=FIRSTDATE('Date'[Date])
var SelectDateMax=LASTDATE('Date'[Date])
return CALCULATE(DISTINCTCOUNT(leg[worker]);leg[startdate]<=SelectDateMin;ISBLANK(leg[leg_fecegr]) && leg[leg_fecegr] >= SelectDateMax )

When I select April, i need to obtain 3 (Sara, Peter and Mark), On May, I obtain 4 .

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @pelucapampa,

 

Please try this measure:

LegActivos =
VAR SelectDateMin =
    MIN ( 'Dim date'[Date] )
VAR SelectDateMax =
    MAX ( 'Dim date'[Date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Table9[worker] ),
        FILTER (
            ALL ( Table9 ),
            Table9[StartDate(dd/mm/yy)] <= SelectDateMin
                && (
                    Table9[EndDate(dd/mm/yy)] = BLANK ()
                        || Table9[EndDate(dd/mm/yy)] >= SelectDateMax
                )
        )
    )

Best regards,

Yuliana Gu

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

View solution in original post

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @pelucapampa,

 

Please try this measure:

LegActivos =
VAR SelectDateMin =
    MIN ( 'Dim date'[Date] )
VAR SelectDateMax =
    MAX ( 'Dim date'[Date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Table9[worker] ),
        FILTER (
            ALL ( Table9 ),
            Table9[StartDate(dd/mm/yy)] <= SelectDateMin
                && (
                    Table9[EndDate(dd/mm/yy)] = BLANK ()
                        || Table9[EndDate(dd/mm/yy)] >= SelectDateMax
                )
        )
    )

Best regards,

Yuliana Gu

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

Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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