Forum Discussion

jajecko's avatar
jajecko
Icon for Helper I rankHelper I
7 years ago

Distinctcount with FILTER true/false

HI guys, 

 

I'm trying to get number of clients who meet certain conditions. 

 

Clients who didn't have any sales before certain period and who have sales after certain period. 

So I have 2 measures:
before = CALCULATE([Total Revenue];DATESBETWEEN(Calendar[Date];DATE(2018;03;01);DATE(2018;08;31)))+0
after = CALCULATE([Total Revenue];DATESBETWEEN(Kalendarz[Date];DATE(2018;9;1);date(2018;12;31)))+0

Then I've used IF funciton:
True/False = IF([before]=0 && [after]>0 ;"true";"false")

Now I'd like to count the "true" clients so I tried something like this:

 

 True count = CALCULATE(DISTINCTCOUNT('Clients'[Code]);FILTER('Clients';[True/False]="true"))+0

and it works in most cases, but not always. As you can see on the screenshot below: B193A is marked as "false" but it is counted as "True".
I'm missing something here but not sure what it is;) 


 

3 Replies

  • PattemManohar's avatar
    PattemManohar
    Icon for Community Champion rankCommunity Champion

    Missing Screenshot... Please attach the screenshot to understand your issue in detail...

  • v-danhe-msft's avatar
    v-danhe-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi jajecko,

    Could you please offer some sample data to have a test or share the pbix file if possible?

     

    Regards,

    Daniel He

  • Hi,

     

    Try this measure

     

    =COUNTROWS(FILTER(SUMMARIZE(VALUES(Clients[Code]);[Code],"ABCD";CALCULATE([Total Revenue];DATESBETWEEN(Calendar[Date];DATE(2018;03;01);DATE(2018;08;31)))+0,"EFGH",CALCULATE([Total Revenue];DATESBETWEEN(Kalendarz[Date];DATE(2018;9;1);date(2018;12;31)))+0),[ABCD]=0&&[EFGH]>0))

     

    Hope this helps.