Forum Discussion
Distinctcount, Calculate, y Objetivos
- 7 months ago
Yes, you’ve explained the problem very well, and this is actually a classic Power BI / DAX modeling challenge. You are very close already — the issue is not DISTINCTCOUNT, it’s how targets are aggregated across areas.
I’ll explain it step by step, conceptually first, then give you a clean, scalable DAX solution (no hard-coding Area 1, 2, 3).
Why your current approach breaks
1. Customers are not additive
You already handled this correctly2. Targets should NOT be summed
This is the key problem: 'Qt Target Customers ≠ Area1 + Area2 + Area3', because- Customers can appear in multiple areas
- Targets are area-based percentages
- Summing targets creates double counting
Targets must be evaluated per area, then re-evaluated at company level, not summed.
You need to think like this:
For each area:- Take last year’s DISTINCT customers
- Apply that area’s growth %
- Then, Recalculate the DISTINCT customers under the current filter context
That means:
- No separate measures per area
- No SUM of targets
- Use iterator logic (SUMX) with DISTINCTCOUNT inside
Solution
Step1 = Create an Area Target table
Create a small dimension table manually and lets called it as 'AreaTarget'Area Growth %
1 0.10
2 0.15
3 0.25This makes the solution: Dynamic, Scalable, and Filterable
Step 2 = Create Base measures
---DAX---
Qt Customers = DISTINCTCOUNT ( Customers[NIF] )
Qt Customers LY = CALCULATE ([Qt Customers],SAMEPERIODLASTYEAR('Date'[Date]))
---DAX---Step 3 – Target Customers measures (KEY MEASURE)
---DAX---
Qt Target Customers=
SUMX (
VALUES ( Area[Area] ),
VAR Growth =
SELECTEDVALUE ( AreaTargets[Growth %], 0 )
RETURN
CALCULATE (
[Qt Customers LY] * ( 1 + Growth )
)
)
---DAX---Why this works?
'VALUES(Area[Area])' >> iterates each area separately
Each area:- Calculates its own DISTINCT customers LY
- Applies its own growth %
At company level:
- Power BI re-evaluates DISTINCTCOUNT correctly
- No double counting
- No incorrect sums
What happens now in visuals?
Visual Filter Result
Area = 1 Target = LY × 1.10
Area = 2 Target = LY × 1.15
Area = 3 Target = LY × 1.25No area filter (Company) Correct company target without double counting
- Works with slicers
- Works with totals
- No hard-coded areas
- No averages needed
Why “AVERAGE” is wrong here?
You mentioned: “I don’t know how to make company target an average”- It should NOT be an average
- It should be a re-evaluated DISTINCTCOUNT under combined filter context
DAX does this naturally when written correctly.
Important DAX takeaway
If something is not additive (DISTINCTCOUNT, ratios, targets):
- Never SUM measures
- Use iterators (SUMX / AVERAGEX)
- Let filter context do the work
=================================================================
Did I answer your question? Mark my post as a solution! This will help others on the forum!Appreciate your Kudos!!
Jaywant Thorat | MCT | Data Analytics Coach
LinkedIn: https://www.linkedin.com/in/jaywantthorat/
Join #MissionPowerBIBharat = https://shorturl.at/5ViW9
#MissionPowerBIBharat
LIVE with Jaywant Thorat from 10 Jan 2026
8 Days | 8 Sessions | 1 hr daily | 100% Free
Hi EstanisMiret
you are surely more expert than me on the best way to do that calculation. Hope I supported you in a good way to stimulate the thoughts
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI