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

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;) 


2018-09-21 15_43_59-asdasd — Power BI Desktop.png

 

3 REPLIES 3
Ashish_Mathur
Super User
Super User

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-danhe-msft
Employee
Employee

Hi @jajecko,

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

 

Regards,

Daniel He

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

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





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




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.