Forum Discussion

KuntalSingh's avatar
KuntalSingh
Helper V
3 years ago
Solved

Need Help on countif formula

Hi Team,

 

Mention below is my data in excel and i want to applied mention below formula

 

=COUNTIFS(DATA!$AN:$AN,"<"&VALIDATION!A3,DATA!$AO:$AO,">="&VALIDATION!A3,DATA!$AD:$AD,"IBM",DATA!$AM:$AM,"VALIDATION")

 

AN:AN is final start date and AO:AO is the Final start date AD:AD is IBM/IOCL and AM:AM is Activity.

 

Can you please help how i implement this in power bi

 

Document IdFull NameActual Start Date & TimeActual End Date & TimeIBM / IOCLStart DateStart DayStart Date 2Start Day 2End DateEnd DayNetwork DaysAgeingActivityFinal Start DateFinal End Date
2000281903 06-Feb-2023 17:18:5206-Feb-2023 17:24:28IOCL06-Feb-2023 17:18:52Mon06-Feb-23Mon06-Feb-2023 17:24:28Mon0  06-Feb-2306-Feb-23
2000281903 07-Feb-2023 15:46:2107-Feb-2023 15:50:18IBM06-Feb-2023 17:24:28Mon06-Feb-23Mon07-Feb-2023 15:50:18Tue11 DayVALIDATION06-Feb-2307-Feb-23
2000281903 07-Feb-2023 15:50:3407-Feb-2023 15:50:34IOCL07-Feb-2023 15:50:18Tue07-Feb-23Tue07-Feb-2023 15:50:34Tue0  07-Feb-2307-Feb-23
2000281903 07-Feb-2023 16:31:4507-Feb-2023 16:31:45IOCL07-Feb-2023 15:50:34Tue07-Feb-23Tue07-Feb-2023 16:31:45Tue0  07-Feb-2307-Feb-23
2000281903 07-Feb-2023 16:31:4807-Feb-2023 16:31:48IOCL07-Feb-2023 16:31:45Tue07-Feb-23Tue07-Feb-2023 16:31:48Tue0  07-Feb-2307-Feb-23
2000281903 08-Feb-2023 11:22:1308-Feb-2023 11:22:13IOCL07-Feb-2023 16:31:48Tue07-Feb-23Tue08-Feb-2023 11:22:13Wed1  07-Feb-2308-Feb-23
2000281903 08-Feb-2023 11:22:1708-Feb-2023 11:22:17IOCL08-Feb-2023 11:22:13Wed08-Feb-23Wed08-Feb-2023 11:22:17Wed0  08-Feb-2308-Feb-23
2000281903 08-Feb-2023 11:33:5608-Feb-2023 11:33:57IOCL08-Feb-2023 11:22:17Wed08-Feb-23Wed08-Feb-2023 11:33:57Wed0  08-Feb-2308-Feb-23
2000281903 08-Feb-2023 11:34:0008-Feb-2023 11:34:00IOCL08-Feb-2023 11:33:57Wed08-Feb-23Wed08-Feb-2023 11:34:00Wed0  08-Feb-2308-Feb-23
2000281903 09-Feb-2023 14:57:5609-Feb-2023 14:57:56IOCL08-Feb-2023 11:34:00Wed08-Feb-23Wed09-Feb-2023 14:57:56Thu1  08-Feb-2309-Feb-23
2000281903 09-Feb-2023 14:57:5909-Feb-2023 14:57:59IOCL09-Feb-2023 14:57:56Thu09-Feb-23Thu09-Feb-2023 14:57:59Thu0  09-Feb-2309-Feb-23
2000281903 09-Feb-2023 14:58:0109-Feb-2023 15:09:47IOCL09-Feb-2023 14:57:59Thu09-Feb-23Thu09-Feb-2023 15:09:47Thu0  09-Feb-2309-Feb-23
2000281903 09-Feb-2023 15:09:4809-Feb-2023 15:09:48IOCL09-Feb-2023 15:09:47Thu09-Feb-23Thu09-Feb-2023 15:09:48Thu0  09-Feb-2309-Feb-23
2000281903 09-Feb-2023 15:09:5009-Feb-2023 15:09:51IOCL09-Feb-2023 15:09:48Thu09-Feb-23Thu09-Feb-2023 15:09:51Thu0  09-Feb-2309-Feb-23
2000281903 09-Feb-2023 15:09:5109-Feb-2023 15:09:51IOCL09-Feb-2023 15:09:51Thu09-Feb-23Thu09-Feb-2023 15:09:51Thu0  09-Feb-2309-Feb-23
2000281903 09-Feb-2023 15:09:5409-Feb-2023 15:09:54IOCL09-Feb-2023 15:09:51Thu09-Feb-23Thu09-Feb-2023 15:09:54Thu0  09-Feb-2309-Feb-23
2000281904 06-Feb-2023 17:19:0706-Feb-2023 17:24:29IOCL06-Feb-2023 17:19:07Mon06-Feb-23Mon06-Feb-2023 17:24:29Mon0  06-Feb-2306-Feb-23
2000281904 07-Feb-2023 15:46:5507-Feb-2023 15:50:47IBM06-Feb-2023 17:24:29Mon06-Feb-23Mon07-Feb-2023 15:50:47Tue11 DayVALIDATION06-Feb-2307-Feb-23
2000281904 07-Feb-2023 15:57:0707-Feb-2023 15:57:07IOCL07-Feb-2023 15:50:47Tue07-Feb-23Tue07-Feb-2023 15:57:07Tue0  07-Feb-2307-Feb-23
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi KuntalSingh ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create a measure. 

    Countif =
    CALCULATE (
        COUNTROWS (
            FILTER (
                ALL ( Data ),
                'Data'[Final Start Date] < MAX ( 'VALIDATION'[A3] )
                    && 'Data'[Final End Date] >= MAX ( 'VALIDATION'[A3] )
                    && 'Data'[IBM / IOCL] = "IBM"
                    && 'Data'[Activity] = "VALIDATION"
            )
        )
    )
    

    (3) Then the result is as follows.

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi KuntalSingh ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create a measure. 

    Countif =
    CALCULATE (
        COUNTROWS (
            FILTER (
                ALL ( Data ),
                'Data'[Final Start Date] < MAX ( 'VALIDATION'[A3] )
                    && 'Data'[Final End Date] >= MAX ( 'VALIDATION'[A3] )
                    && 'Data'[IBM / IOCL] = "IBM"
                    && 'Data'[Activity] = "VALIDATION"
            )
        )
    )
    

    (3) Then the result is as follows.

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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