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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
LS1700
Resolver I
Resolver I

Summarize with filters

Hello,

 

I have this table, and I want to create a measure that can tells me how many customers have bought at least one unit, in a specific point in time.

Basically, I want to have a filters on my my page to play with: dates, and countries.

the measure should tell me for a selected country and date how many customers have bought at least one unit, regardless the segment.

 

does anyone have a formula in mind?

would it be better to create a table instead?

 

 

(in the example I put only one date)

DateCountrySegmentCustomerSales
01-01-17AXJohn1
01-01-17AXAl2
01-01-17AZJohn2
01-01-17AZAl2
01-01-17BZRoss0
01-01-17BXJane1
01-01-17BZJane1
01-01-17CXFrank1

 

thanks

 

1 ACCEPTED SOLUTION

Well, I think I found the solution:

 

 

# of dealers = CALCULATE(DISTINCTCOUNT([Customer]),filter(ALLEXCEPT(Sheet1,Sheet4[country]),Sheet1[sales]>0),FILTER(ALLEXCEPT(Sheet1,Sheet4[country]),Sheet1[Date]=Max(Sheet1[Date])))

regards

 

View solution in original post

7 REPLIES 7
Phil_Seamark
Employee
Employee

HI @LS1700,

 

If I understand you correctly, I think the following calculated measure might be close.  It will simply count the number of customers based on your current slicer selections over the other fields.  Let me know how this goes,

 

Active Customers = CALCULATE(
			DISTINCTCOUNT(Table1[Customer]),
			FILTER('Table1',SUM('Table1'[Sales])>0))

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi, thanks for your reply.

I tried your the same thing at first. The problem is that I have buttons on my page with segments. So if I click on one segment the formula will calculate the value for the selected segment. And I do not want that.
Makes sense?

Thank you

Hi @LS1700,

 

The filters interact with each other. We can use "Edit interactions" to control them. You can set them with step 1 and 2 in the image. You can see the result with step 3 and 4.

Maybe this measure is better.

Active Customers =
CALCULATE (
    DISTINCTCOUNT ( Table1[Customer] ),
    'Table1'[Sales] > 0,
    ALLEXCEPT ( Table1, Table1[Country], Table1[Date] )
)Summarize with filters .jpg

 

 

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

Hi, I ll give it a Try to your formula.

I had the very same idea for the interactions, but the problem is that I need the results of the measure to calculate another value.

Yes... Not simple 🙂

Hi, @LS1700

 

With this measure I just posted, the result will only be filtered by "country" and "date". So other slicer like "Segment" will not affect the result. The slicer only hide or show the result, but not recalculate it now.

Active Customers =
CALCULATE (
    DISTINCTCOUNT ( Table1[Customer] ),
    'Table1'[Sales] > 0,
    ALLEXCEPT ( Table1, Table1[Country], Table1[Date] )

)

 

Best regards
Dale

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

Hi,

thanks for your suggestion.

 

I feel it is very close to what I am looking for. Unfortunately it does not entirely fulfil what I am looking for.

 

 

the porblem is with the date: my date "filter" is a slicer, I use this formula to filteron the largest date selcted within the slicer:

filter(all(Sheet1[Month Date]), Sheet1[Month Date]=Max(Sheet1[Month Date])))

 

the problem is that if I add it to your formula it will start to ingnore the "ALLEXCEPT".

 

I have been looking to other posts on the forum, it seems the "FILTER" function removes the condition "ALLEXPECT"

https://community.powerbi.com/t5/Desktop/Filter-and-Allexcept/m-p/87832

 

 

 any idea?

 

Well, I think I found the solution:

 

 

# of dealers = CALCULATE(DISTINCTCOUNT([Customer]),filter(ALLEXCEPT(Sheet1,Sheet4[country]),Sheet1[sales]>0),FILTER(ALLEXCEPT(Sheet1,Sheet4[country]),Sheet1[Date]=Max(Sheet1[Date])))

regards

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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