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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
smithshire
Frequent Visitor

Saving daily "Count"

I have a visual that displays the daily count of the total number of open contracts. Is there a way of storing this value each day in a table? 

1 ACCEPTED SOLUTION

Hi @smithshire ,

 

The calculation is based on your data model. I think there should be a contract table with the open date and close date for your contracts.

1.png

Create a DimDate table and then create a measure to calculate the daily count of the total number of open contracts.

DimDate = CALENDARAUTO()

Measure:

Daily count of the total number of open contracts = 
CALCULATE (
    COUNT ( 'Table'[Contracts] ),
    FILTER (
        'Table',
        'Table'[Open Date] <= MAX ( DimDate[Date] )
            && 'Table'[Close Date] >= MAX ( DimDate[Date] )
    )
)

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Samarth_18
Community Champion
Community Champion

Hi @smithshire ,

 

I think you can't save it anywhere. But few workaround as below:-

1. Stored this data in DB.

2. or Create a seperate measure which calculate the total count for yesterday like today()-1.

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

smithshire
Frequent Visitor

Will this store each daily value?

Hi @smithshire ,

 

The calculation is based on your data model. I think there should be a contract table with the open date and close date for your contracts.

1.png

Create a DimDate table and then create a measure to calculate the daily count of the total number of open contracts.

DimDate = CALENDARAUTO()

Measure:

Daily count of the total number of open contracts = 
CALCULATE (
    COUNT ( 'Table'[Contracts] ),
    FILTER (
        'Table',
        'Table'[Open Date] <= MAX ( DimDate[Date] )
            && 'Table'[Close Date] >= MAX ( DimDate[Date] )
    )
)

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-rzhou-msft 

 

That works great apart from where we have contracts that are still open that do not have an closed date. How would I amend the measure to include these in the count?

 

Regards

truptis
Community Champion
Community Champion

@smithshire , Table a table visual, put Date field and your measure. It will give you the count.

 

You can create a measure too for counting contracts: Count_of_Contracts = Count(columnname of open contracts)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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