Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I am looking to calculate and visualise number of active contracts on continious time x axis. Looking at the chart I should be able to identify min and max number of active contracts at any day.
Active from | Active to | Contract |
10/01/2023 | 20/01/2023 | A |
12/01/2023 | 23/03/2023 | B |
20/01/2023 | 31/01/2023 | C |
23/01/2023 | 05/04/2023 | D |
24/01/2023 | 08/02/2023 | E |
06/02/2023 | 24/03/2023 | F |
08/02/2023 | 23/02/2023 | G |
Would anyone be able to help or direct me where to start?
Solved! Go to Solution.
You can use
Active contracts =
VAR MaxDate =
MAX ( 'Date'[Date] )
VAR Result =
CALCULATE (
COUNTROWS ( 'Table' ),
'Table'[Active from] <= MaxDate
&& 'Table'[Active to] >= MaxDate
)
RETURN
Result
Make sure that there are no active relationships between your date table and fact table, or if there are you will need to add REMOVEFILTERS('Date') into the CALCULATE
I nneeded to create calendar column first.
Formula worked without MAX before ('Date'[Date]
You can use
Active contracts =
VAR MaxDate =
MAX ( 'Date'[Date] )
VAR Result =
CALCULATE (
COUNTROWS ( 'Table' ),
'Table'[Active from] <= MaxDate
&& 'Table'[Active to] >= MaxDate
)
RETURN
Result
Make sure that there are no active relationships between your date table and fact table, or if there are you will need to add REMOVEFILTERS('Date') into the CALCULATE
User | Count |
---|---|
15 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
31 | |
18 | |
13 | |
7 | |
5 |