cancel
Showing results for
Did you mean:
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)

 Date Country Segment Customer Sales 01-01-17 A X John 1 01-01-17 A X Al 2 01-01-17 A Z John 2 01-01-17 A Z Al 2 01-01-17 B Z Ross 0 01-01-17 B X Jane 1 01-01-17 B Z Jane 1 01-01-17 C X Frank 1

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Resolver I

## Re: Summarize with filters

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

7 REPLIES 7
Microsoft

## Re: Summarize with filters

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

Proud to be a Datanaut!

Resolver I

## Re: Summarize with filters

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
Microsoft

## Re: Summarize with filters

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

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.
Resolver I

## Re: Summarize with filters

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 🙂
Microsoft

## Re: Summarize with filters

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.
Resolver I

## Re: Summarize with filters

Hi,

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?

Resolver I

## Re: Summarize with filters

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

Announcements

#### Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

#### MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

#### ‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors