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

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.

Reply
ArchStanton
Impactful Individual
Impactful Individual

Measure requires additional parameter

Hi,

 

This measure successfully gives me the amount of ALL Cases closed:

 

YTD Closures = CALCULATE(COUNT('Cases'[incidentid]),FILTER('Cases',[statecode_display]="resolved"))
 
I would like to modify it so that it just counts YTD or after 31/03 using the 'resolution Date' column
 
I'm not quite sure how to modify the measure?
Thanks
6 REPLIES 6
BA_Pete
Super User
Super User

Hi @ArchStanton ,

 

If you get yourself set up with a related calendar table, you can make use of the OTB time intelligence functions.

There's plenty of resource online how to create a calendar table, so I'll assume you've created one with a column called [date] and related it to your fact table in the data model on calendar[date] ONE : MANY Cases[Resolution Date]:

_closuresYTD =
CALCULATE(
    COUNT('Cases'[incidentid]),
    [statecode_display] = "resolved",
    DATESYTD(calendar[date], "31/03")
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




ArchStanton
Impactful Individual
Impactful Individual

Hi Pete,

 

Thanks for replying.

Hi have a date table but the dates I need to reference are are in the cases table where the resolution date exists. There are several date columns in my Cases table and I need to perform calculations or measures on them directly if possible?

 

So going back to my original example, I have resolution date in my Cases table, how would you modify the code for YTD so far?

 

Thanks

A

Hi @ArchStanton ,

 

Relate your calendar[date] field in your data model to Cases[Resolution Date]. If you already have a relationship in place, this new one will show as INACTIVE when you create it. To activate the inactive relationship for the purposes of your measure, use this:

_closuresYTD =
CALCULATE(
    COUNT('Cases'[incidentid]),
    DATESYTD(calendar[date], "31/03"),
    USERELATIONSHIP(calendar[date], Cases[Resolution Date])
)

 

I've removed the [statecode_display] = "resolved" condition as I'm assuming that items only get a [Resolved Date] once marked as resolved.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




ArchStanton
Impactful Individual
Impactful Individual

I tweaked the code to this as it wasn't working initially:

 

YTD Closures = CALCULATE
            (COUNT('Cases'[incidentid]),
            DATESYTD('Date'[Date], "31/03"),
            USERELATIONSHIP('IntoArea'[Date], 'Cases'[pre_resolutiondate]),
            FILTER('Cases','Cases'[statecode_display] = "resolved"))

 

However the numbers are way off, I'm gettin 1,945 and I should be getting 3,426

 

Is it possibe to do away with SYSDATE and just possibly use calculate, countrows or count & format combination to count how many cases have been resolved since resolution date >"31/03") this year?

It sounds so easy but it's proving to be very problematic!

 

Hi @ArchStanton ,

 

If you're getting the wrong numbers using the measure I provided then I think there must have been a setup issue. Please check the following:

 

1) You must use calendar[date] on your chart axis

2) Your calendar table must be marked as a date table

BA_Pete_0-1662012051758.png

 

3) There must be an active (if NOT using USERELATIONSHIP) or an inactive (if using USEREL) relationship between your fact table and the calendar table.

 

Getting the correct setup to be able to use the time intel functions is the optimal solution, so please check the above first.

 

You can run the cumulative value without using the DATESYTD() time intel function, but you'll still need to reference the calendar table and use calendar[date] on the chart axis, something like this:

YTD Closures =
VAR __cDate = MAX(calendar[date])
VAR __cYear = YEAR(__cDate)
RETURN
CALCULATE(
    COUNT(Cases[incidentid]),
    FILTER(
        ALLSELECTED(calendar),
        calendar[date] <= __cDate
        && calendar[date] >= DATE(__cYear, 04, 01)
    )
)

 

If this still doesn't work, then I'll need a bit more information about your data model (relationships and fields), and some sample data to work out what's going wrong in your scenario.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




ArchStanton
Impactful Individual
Impactful Individual

Thanks Pete, I will explore these ideas over the coming weeks and get back to you if I have any questions.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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