March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
EmployeeID Start Date End Date
1 01/01/2021 31/12/2021
2 01/01/2022 31/03/2023
3 01/08/2023
4 01/01/2023
5 01/03/2023 31/08/2023
For the above scenario I want plot the Total Record Count on a Line Graph that shows me the ongoing Active Records taking into account the Date on the X-Axis and taking into account the Start and End Date of the Employee.
Any help or pointers appreciated!
Solved! Go to Solution.
Hi @derekmac
You need to have a disconnected date table. Your count measure would be:
Count =
SUMX (
VALUES ( 'Date'[Date] ),
COUNTROWS (
FILTER (
'Table',
'Table'[Start Date] <= 'Date'[Date]
&& COALESCE ( 'Table'[End Date], TODAY () ) >= 'Date'[Date]
)
)
)
@derekmac
Create a date table and keep it disconnected from the main table (no relationships). It should contain all the dates from minimum start date to the maximum end date. Example
Date = CALENDAR ( MIN ( 'Table'[Start Date] ), MAX ( 'Table'[End Date] ) )
Place 'Date'[Date] in a table visual along with the count measure
Count =
SUMX (
VALUES ( 'Date'[Date] ),
COUNTROWS (
FILTER (
'Table',
'Table'[Start Date] <= 'Date'[Date]
&& COALESCE ( 'Table'[End Date], TODAY () ) >= 'Date'[Date]
)
)
)
Please try
Count =
SUMX (
VALUES ( 'Date'[Date] ),
SUMX (
FILTER (
'Table',
'Table'[Start Date] <= 'Date'[Date]
&& COALESCE ( 'Table'[End Date], TODAY () ) >= 'Date'[Date]
),
'Table'[Target]
)
)
Hi
Total Prospects =
SUMX (
VALUES ( 'Dates'[End of Week] ),
COUNTROWS (
FILTER (
'Prospects',
'Prospects'[Date Added] <= 'Dates'[End of Week]
&& COALESCE ( Prospects[Date Closed], TODAY () ) >= 'Dates'[End of Week]
)
)
)
How would I amend the above to calculate only for the last 7 days?
I don't understand that
@derekmac
Create a date table and keep it disconnected from the main table (no relationships). It should contain all the dates from minimum start date to the maximum end date. Example
Date = CALENDAR ( MIN ( 'Table'[Start Date] ), MAX ( 'Table'[End Date] ) )
Place 'Date'[Date] in a table visual along with the count measure
Count =
SUMX (
VALUES ( 'Date'[Date] ),
COUNTROWS (
FILTER (
'Table',
'Table'[Start Date] <= 'Date'[Date]
&& COALESCE ( 'Table'[End Date], TODAY () ) >= 'Date'[Date]
)
)
)
Target
1
2
3
4
5
If I had a 4th Column called Target, how would I change the DAX to sum this column using the disconnected table instead of Counting Rows?
I want to add a target line to my Line Graph too
Thank you so much for you help so far, I have not come across this technique before, it is quite advanced for me!
Please try
Count =
SUMX (
VALUES ( 'Date'[Date] ),
SUMX (
FILTER (
'Table',
'Table'[Start Date] <= 'Date'[Date]
&& COALESCE ( 'Table'[End Date], TODAY () ) >= 'Date'[Date]
),
'Table'[Target]
)
)
Thank you so much
Hi @derekmac
You need to have a disconnected date table. Your count measure would be:
Count =
SUMX (
VALUES ( 'Date'[Date] ),
COUNTROWS (
FILTER (
'Table',
'Table'[Start Date] <= 'Date'[Date]
&& COALESCE ( 'Table'[End Date], TODAY () ) >= 'Date'[Date]
)
)
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
26 | |
21 | |
20 | |
14 | |
10 |