Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I want to do a distinct count of accounts active in the last year and a half that are not closed. I'm thinking of something like this. Will this work or am I missing something?
CALCULATE(
DISTINCTCOUNT([DimAccountKey]),
DATESINPERIOD (DimDate[DateKey], MAX (DimDate[DateKey]), -18, MONTH ),
'DimAccount'[IsClosed]=FALSE()
)
Solved! Go to Solution.
Hi, @data_guy
You can try the following methods.
Measure =
CALCULATE (
DISTINCTCOUNT ( [DimAccountKey] ),
DATESINPERIOD ( DimDate[DateKey], MAX ( DimDate[DateKey] ), -18, MONTH ),
FILTER ( ALL ( 'DimAccount' ), [IsClosed] = FALSE () )
)
Or
Measure =
CALCULATE (
DISTINCTCOUNT ( [DimAccountKey] ),
FILTER (
ALL ( DimDate ),
DATESINPERIOD ( DimDate[DateKey], MAX ( DimDate[DateKey] ), -18, MONTH )
),
FILTER ( ALL ( 'DimAccount' ), [IsClosed] = FALSE () )
)
If the desired results are not obtained, can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
While the accepted solution from v-zhangti does work, I ended up changing the metric in SQL Server so that I only had to filter using DAX for the DATESINPERIOD. Thank you.
Hi, @data_guy
You can try the following methods.
Measure =
CALCULATE (
DISTINCTCOUNT ( [DimAccountKey] ),
DATESINPERIOD ( DimDate[DateKey], MAX ( DimDate[DateKey] ), -18, MONTH ),
FILTER ( ALL ( 'DimAccount' ), [IsClosed] = FALSE () )
)
Or
Measure =
CALCULATE (
DISTINCTCOUNT ( [DimAccountKey] ),
FILTER (
ALL ( DimDate ),
DATESINPERIOD ( DimDate[DateKey], MAX ( DimDate[DateKey] ), -18, MONTH )
),
FILTER ( ALL ( 'DimAccount' ), [IsClosed] = FALSE () )
)
If the desired results are not obtained, can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi @data_guy
it shall work if the tables are related properly.
Just try and let us know.
If it fails, pls tell us how are the tables related with each other.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |