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
AFra
Helper III
Helper III

count filtered values based on several criteria (from another table)

Hi pbi community, 

 

I am struggeling with a problem : I need to count the LiaisonKey on the table 'Demande'. 

In this main table, all the liaisonkeys are distinctvalues. 

In the rad table, some liaisonkeys appear more than once. 

I need to count all the liaisonkey in Demande excluding all the liaisonkey in Rad IF : 

- earliest DateRadiation for each liaisonkey is > 01-05-2021 AND

- DtDerad for that same liaisonkey and Dateradiation is blank

 

I tried a simple measure : 

test =
var my_date = date(01,05,2021)
return
calculate(DISTINCTCOUNT(Demande[LIAISONKEY]),
LASTDATE(Radiatio[DateRadiation])<my_date,
ISBLANK(Radiatio[DtDerad])
)

  

but it doesn't work. I tried a calculated column in Demande table with lookupvalues, but didn't work neither.

 

Any ideas? 

 

 here's a sample of my dataset : https://www.transfernow.net/dl/20211014cnFR4oG1/dJ6BZELN

 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @AFra 

 

According to your description, You can create a measure.

Like this:

Measure2 =
VAR eardate =
    CALCULATE (
        MIN ( Rad[DateRadiation] ),
        FILTER ( ALL ( Rad ), [LiaisonKey] = SELECTEDVALUE ( Rad[LiaisonKey] ) )
    )
RETURN
    CALCULATE (
        DISTINCT ( Demande[LIAISONKEY] ),
        FILTER ( ALL ( Rad ), [DtDerad] <> BLANK () && eardate <= DATE ( 2021, 1, 5 ) )
    )

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

View solution in original post

1 REPLY 1
v-janeyg-msft
Community Support
Community Support

Hi, @AFra 

 

According to your description, You can create a measure.

Like this:

Measure2 =
VAR eardate =
    CALCULATE (
        MIN ( Rad[DateRadiation] ),
        FILTER ( ALL ( Rad ), [LiaisonKey] = SELECTEDVALUE ( Rad[LiaisonKey] ) )
    )
RETURN
    CALCULATE (
        DISTINCT ( Demande[LIAISONKEY] ),
        FILTER ( ALL ( Rad ), [DtDerad] <> BLANK () && eardate <= DATE ( 2021, 1, 5 ) )
    )

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

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