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.
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
Solved! Go to 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
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))
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] )
)
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
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |