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

finding values not zero

Greetings,

 

This simple DAX formula is eluding me.

 

I have a report filtered by Supplier, and I wish to count the number of customers who have purchased some of their product in 2017 (Gross > 0 )

 

I wish to put up widget to show the # of customers in 2017, of course this value would change for each Supplier sliced.

 

 

(Slicing and filtering by Year 2017, user_id, manufacture_id)

 

Capture.PNG

 

 

As always the help of the community is always appreciated.

 

Best from Nova Scotia's beautiful Annpolis Valley.

 

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

 

Try this

 

=CALCULATE(DISTINCTCOUNT(Data[id]),Data[Gross]>0)

 

Select any year/Supplier via the Filter section/slicer.

 

I have assumed that id is the Customer id.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Not quite the solution to my issue, likely due to my poor explanation.

 

I have made some progress (I think).

 

ADF = COUNTAX(FILTER(gross_sales,[Sales 2017]>0),[Gross])

Sales 2017 = CALCULATE(SUM(gross_sales[Gross]),gross_sales[year]=2017)

 

along with manufacturer_id, and user_id, I have this sample table. In effect, I am looking to count the number of items in column ADF (the values are the actual number of transaction to comprise the Sales 2017 value).

 

manufacturer_iduser_idSales 2017ADF
10273$0 
10274$6,0083
10275$0 
10276$14,9727
10277$4,93410
10278$65,66212
10279$0 
10280$0 
10282$0 
10283$0 
10284$1,3254
10285$0 
10286$9,48710

 

The answer I am looking for in this sample, would be 6.

 

I very appreciate your time, with many thanks.

Hi,

 

=CALCULATE(COUNTA(Data[user_id]),Data[Sales 2017]>0)

 

Does this work?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sorry no.

 

Dealer_Count = CALCULATE(COUNTA(gross_sales[user_id]),gross_sales[Sales 2017] > 0)  creates this message:

 

A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

 

Thanks for your ongoing assistance.

 

Frank

Hi,

 

It works absolutely fine.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Greetings again, 

 

Again thank you for working through this issue with me.

 

I have isolated the issue down to my use of a measure with a measure, "Sales 2017" is itself a measure "active = CALCULATE(counta(gross_sales[user_id]),gross_sales[Sales 2017]>0)" resulting in the error message, "A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed." My data is "gross_sales".

 

I have replicated your Data table, where I have individual values in the "Sale 2017" column, not a measure. In the Data table your formula works as designed.

 

I have attached a sample of my report to this reply.

 

Is there a way to make my measure "Sales 2017" work within this scenario? Alternates?

 

 

https://e2fe3c147248bbb3-my.sharepoint.com/:f:/g/personal/fklatecki_indeal_org/EsKlQdulUCZEhdUkla6S3...

Hi,

 

I am now completely confused.  You are now bringing another table.  All this while you were talking about only 1 table.  Now there are two.  Please explain the question very clearly.  Do not be concerned with any formulas.  First explain the business problem clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I apologize for causing confusion. Per my BI sample, I am working with the “gross_sales”. I am looking to determine the number of Suppliers (manufacturer_id) with purchase made in 2017 by Dealers(user_id), this would determine the number of “Active Dealers”.

 

I created the measure “Sales 2017” to isolate sales in 2017, and then filter by Supplier, by Dealer, and then counting the number of rows greater than zero.

 

Best

Greetings,

 

Looking for solution to my DAX formula issue?

 

Re: finding values not zero
 
 

I apologize for causing confusion. Per my BI sample, I am working with the “gross_sales”. I am looking to determine the number of Suppliers (manufacturer_id) with purchase made in 2017 by Dealers(user_id), this would determine the number of “Active Dealers”.

 

I created the measure “Sales 2017” to isolate sales in 2017, and then filter by Supplier, by Dealer, and then counting the number of rows greater than zero.

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.