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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KuntalSingh
Helper III
Helper III

Need help on formual COUNTIFS

I have a data slicer and a LOB slicer and a Team slicer.

I need to implement forluma =COUNTIFS(DATA!$AN:$AN,"<"&VALIDATION!A3,DATA!$AO:$AO,">="&VALIDATION!A3,DATA!$AD:$AD,"TCS",DATA!$AM:$AM,"VALIDATION")

Where AN:AN is Start date and AO:AO is the end date if I select any date from slicer and Team as TCS from slicer and LOB from slicer as Validation then  I need count of dates based on the condition.

KuntalSingh_0-1677128228877.png

 

KuntalSingh_1-1677128298789.png

 

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

Hi  @KuntalSingh ,

 

You can try the following dax:

Create measure:

The slicer selects two dates

 

Measure =
var _mindate=MINX(ALLSELECTED('VALIDATION'),[Date])
var _maxdate=MAXX(ALLSELECTED('VALIDATION'),[Date])
return
COUNTX(
    FILTER(ALL(DATA),
    'DATA'[Final Start Date]>_mindate&&'DATA'[Final End Date]<=_maxdate&&'DATA'[Team]="TCS"&&'DATA'[Activity]="VALIDATION"),[Final Start Date])

 

OR:

The slicer selects one date

 

Measure2 =
var _select=SELECTEDVALUE('VALIDATION'[Date])
return
COUNTX(
    FILTER(ALL(DATA),
    'DATA'[Final Start Date]>_select&&'DATA'[Final End Date]<=_select&&'DATA'[Team]="TCS"&&'DATA'[Activity]="VALIDATION"),[Final Start Date])

 

 

Best Regards,

Liu Yang

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-yangliu-msft
Community Support
Community Support

Hi  @KuntalSingh ,

 

You can try the following dax:

Create measure:

The slicer selects two dates

 

Measure =
var _mindate=MINX(ALLSELECTED('VALIDATION'),[Date])
var _maxdate=MAXX(ALLSELECTED('VALIDATION'),[Date])
return
COUNTX(
    FILTER(ALL(DATA),
    'DATA'[Final Start Date]>_mindate&&'DATA'[Final End Date]<=_maxdate&&'DATA'[Team]="TCS"&&'DATA'[Activity]="VALIDATION"),[Final Start Date])

 

OR:

The slicer selects one date

 

Measure2 =
var _select=SELECTEDVALUE('VALIDATION'[Date])
return
COUNTX(
    FILTER(ALL(DATA),
    'DATA'[Final Start Date]>_select&&'DATA'[Final End Date]<=_select&&'DATA'[Team]="TCS"&&'DATA'[Activity]="VALIDATION"),[Final Start Date])

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Yang,

 

I tried to used mention below code

Available for Action = CALCULATE(COUNT('Sample'[Document Id]),FILTER('Sample','Sample'[Start Date2]<[Selected Date]&&'Sample'[End Date]>=[Selected Date] )) but unfortunately it does not gives the correct data.
Actual count is 1756 as per condition, However my code gives 1655. I have selected 2-02-2023 from slicer

 

 

 

and it is the part of 'Rolling Calender'[Dates]

 

KuntalSingh_0-1678165280940.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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