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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Pacifo
Frequent Visitor

Measure with Date table

Hi all,

I am building a dashboard for our call reporting system to assist with monthly reporting. I have the following setup:

  • Date table which has no relationships

  • Table called "Requests" with fields

    • RequestNumber|CreatedOn|SolvedOn

As you can imagine, RequestNumber is a call number (e.g. 323456), CreatedOn is a start date, and SolvedOn is a end date when the request gets closed (this can also be null). Now I have created a Measure called "Open Requests" which checks if a call was open during the date. Code below.

Open Requests = 
VAR MinDate= MIN( MasterDate[Date] )
VAR MaxDate= MAX( MasterDate[Date] )
RETURN
CALCULATE (
    CALCULATE (
        DISTINCTCOUNT ( list_requests[requestNumber] ),
        list_requests[createdOn] <= MaxDate,
        list_requests[solvedOn] >= MinDate
),ALL( MasterDate ))

This code seemingly works great, so I tried to replicate this for Solved Requests with the following code.

Solved Requests = 
VAR MinDate= MIN( MasterDate[Date] )
VAR MaxDate= MAX( MasterDate[Date] )
RETURN
CALCULATE (
    CALCULATE (
        DISTINCTCOUNT ( list_requests[requestNumber] ),
        list_requests[solvedOn] <= MaxDate,
        list_requests[solvedOn] >= MinDate
),ALL( MasterDate ))

In my dashboard, I am using the Date fields from the Date table as a slicer. In my slicer I have selected week 13 in 2020, which returns the 7 dates. As you can see in the table below Open Requests gives me a breakdown by day, whereas Solved Requests gives me a total (the total is correct). I would like Solved Requests to look like Open Requests totaling the figures each day (as I want to plot the lines on a line chart).

powerbi.png

 

 

I think I am missing something simple here? I tried counting just solved requests, but this seemingly ignores my Date slicer and totals every solved request in my table.

Is somebody able to point me in the right direction?

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Pacifo ,

 

Please refer to these:

https://community.powerbi.com/t5/Desktop/Calculate-value-between-two-dates/td-p/167150 

https://community.powerbi.com/t5/Desktop/Number-of-employee-between-two-dates/td-p/398867 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362#M109 

If the problem persists,could you share the sample pbix or the sample data?(Please mask any sensitive data before uploading.)

 

Best Regards,
Liang
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

1 REPLY 1
V-lianl-msft
Community Support
Community Support

Hi @Pacifo ,

 

Please refer to these:

https://community.powerbi.com/t5/Desktop/Calculate-value-between-two-dates/td-p/167150 

https://community.powerbi.com/t5/Desktop/Number-of-employee-between-two-dates/td-p/398867 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362#M109 

If the problem persists,could you share the sample pbix or the sample data?(Please mask any sensitive data before uploading.)

 

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors