Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
LinasG
New Member

number of active contracts on continious time line

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 fromActive toContract
10/01/202320/01/2023A
12/01/202323/03/2023B
20/01/202331/01/2023C
23/01/202305/04/2023D
24/01/202308/02/2023E
06/02/202324/03/2023F
08/02/202323/02/2023G

 

Would anyone be able to help or direct me where to start?

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

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

View solution in original post

2 REPLIES 2
LinasG
New Member

I nneeded to create calendar column first.

Formula worked without MAX before ('Date'[Date]

johnt75
Super User
Super User

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.