The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi Everyone,
I have a table as specified in the below screenshot. I'm trying to calculate total unique days in the date range.
In this example, expect output is 30
How can we do it in DAX? This calculation needs to happen dynamically and the result will be used in remaining calculations. Hence PowerQuery solution is not suitable.
Solved! Go to Solution.
Hi @nandukrishnavs
This shall give you the desired result at the total level or in a card visual. Please refer to attached sample file.
unique days =
COUNTROWS (
DISTINCT (
SELECTCOLUMNS (
GENERATE (
'Table',
CALENDAR ( 'Table'[start date], 'Table'[end date] )
),
"@Days", [Date]
)
)
)
Hi @nandukrishnavs
This shall give you the desired result at the total level or in a card visual. Please refer to attached sample file.
unique days =
COUNTROWS (
DISTINCT (
SELECTCOLUMNS (
GENERATE (
'Table',
CALENDAR ( 'Table'[start date], 'Table'[end date] )
),
"@Days", [Date]
)
)
)
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
31 | |
11 | |
10 | |
10 | |
9 |