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
Txtcher
Helper V
Helper V

Calculations for As of Dates

I have a simple model consisting of RS Cases (intakes), related Events and a date table:

Txtcher_0-1748598425864.png

I need to create a matrix showing backlog count of intakes. To determine whether an intake is counted as backlog at a certain point in time requires a complicated series of filters.

I have a report in Excel where I think I have accomplished it, but the report requires a merge between RS Cases and RS Events and I want to redesign it so I can avoid having PQ do that merge.

Here is the measure created in the Excel report with a model that looks like this (ignore the table called Cases_Without_Due_Dates - it is a separate query):

Txtcher_1-1748598642729.png

Here is the measure in that report:

Backlog:=CALCULATE(	
	COUNTROWS(RS_Cases),	
		SUMMARIZE(RS_Cases,RS_Cases[Program]),
			FILTER(All(RS_Cases),
			(RS_Cases[Due By]<=MAX(Date_Table[Date]) && RS_Cases[Status]="OPEN" ) ||
			(RS_Cases[Due By]<=MAX(Date_Table[Date]) && RS_Cases[Status]="CLOSED" && RS_Cases[Entrance Date]>Max(Date_Table[Date])) ||
			(RS_Cases[Due By]<=MAX(Date_Table[Date]) && ISBLANK(RS_Cases[Entrance Date]) && RS_Cases[Status]="CLOSED" && RS_Cases[Status Change Date]>MAX(Date_Table[Date])) 
		)
)

In the filter portion of this measure I am using a field called RS_Cases[Entrance Date]. This is a field that originates from the RS Events table in the model at the top of this post (matching field in that table is called [Survey Date]).

Can I recreate this measure in the redesigned model with the 2 separate tables? I cannot figure out how to refer to another table in the midst of filtering a different one.

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Txtcher , Try using

 

DAX
Backlog :=
CALCULATE(
COUNTROWS(RS_Cases),
SUMMARIZE(RS_Cases, RS_Cases[Program]),
FILTER(
ALL(RS_Cases),
(RS_Cases[Due By] <= MAX(Date_Table[Date]) && RS_Cases[Status] = "OPEN") ||
(RS_Cases[Due By] <= MAX(Date_Table[Date]) && RS_Cases[Status] = "CLOSED" &&
LOOKUPVALUE(RS_Events[Survey Date], RS_Events[Case ID], RS_Cases[Case ID]) > MAX(Date_Table[Date])) ||
(RS_Cases[Due By] <= MAX(Date_Table[Date]) && ISBLANK(LOOKUPVALUE(RS_Events[Survey Date], RS_Events[Case ID], RS_Cases[Case ID])) &&
RS_Cases[Status] = "CLOSED" && RS_Cases[Status Change Date] > MAX(Date_Table[Date]))
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

3 REPLIES 3
bhanu_gautam
Super User
Super User

@Txtcher , Try using

 

DAX
Backlog :=
CALCULATE(
COUNTROWS(RS_Cases),
SUMMARIZE(RS_Cases, RS_Cases[Program]),
FILTER(
ALL(RS_Cases),
(RS_Cases[Due By] <= MAX(Date_Table[Date]) && RS_Cases[Status] = "OPEN") ||
(RS_Cases[Due By] <= MAX(Date_Table[Date]) && RS_Cases[Status] = "CLOSED" &&
LOOKUPVALUE(RS_Events[Survey Date], RS_Events[Case ID], RS_Cases[Case ID]) > MAX(Date_Table[Date])) ||
(RS_Cases[Due By] <= MAX(Date_Table[Date]) && ISBLANK(LOOKUPVALUE(RS_Events[Survey Date], RS_Events[Case ID], RS_Cases[Case ID])) &&
RS_Cases[Status] = "CLOSED" && RS_Cases[Status Change Date] > MAX(Date_Table[Date]))
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






EDIT:  I think I have this figured out. The count is cumulative. When you break the count down by another group, it gets spread out. The overall grand total is the same, but the occurence of the backlog for those regions happened prior to Q2 of FY25.

💡😀

 

I have another question:

Why am I not getting the same counts if I add a 2nd grouping to the measure.

First measure grouped by RS Case[Program]:

Backlog = CALCULATE(
    COUNTROWS('RS Cases'),
    SUMMARIZE('RS Cases','RS Cases'[Program]),
    FILTER(
        ALL('RS Cases'),
        ('RS Cases'[Due By]<=Max('Calendar'[Date]) && 'RS Cases'[Status]="OPEN") ||
        ('RS Cases'[Due By]<=Max('Calendar'[Date]) && 'RS Cases'[Status]="CLOSED" &&
        LOOKUPVALUE('RS Events'[Survey_Date__c], 'RS Events'[Id],'RS Cases'[RS Event ID])> Max('Calendar'[Date])) ||
        'RS Cases'[Due By]<=Max('Calendar'[Date]) && ISBLANK(LOOKUPVALUE('RS Events'[Survey_Date__c], 'RS Events'[Id], 'RS Cases'[RS Event ID])) &&
        'RS Cases'[Status]="CLOSED" && 'RS Cases'[Status Change Date]>max('Calendar'[Date]))
    )

Here are the results in a table visual (which are correct):

Txtcher_0-1748613501358.png

But if I create a new measure by adding a 2nd grouping for Region:

Region Backlog = CALCULATE(
    COUNTROWS('RS Cases'),
    SUMMARIZE('RS Cases','RS Cases'[Program], 'RS Cases'[Region]),
    FILTER(
        ALL('RS Cases'),
        ('RS Cases'[Due By]<=Max('Calendar'[Date]) && 'RS Cases'[Status]="OPEN") ||
        ('RS Cases'[Due By]<=Max('Calendar'[Date]) && 'RS Cases'[Status]="CLOSED" &&
        LOOKUPVALUE('RS Events'[Survey_Date__c], 'RS Events'[Id],'RS Cases'[RS Event ID])> Max('Calendar'[Date])) ||
        'RS Cases'[Due By]<=Max('Calendar'[Date]) && ISBLANK(LOOKUPVALUE('RS Events'[Survey_Date__c], 'RS Events'[Id], 'RS Cases'[RS Event ID])) &&
        'RS Cases'[Status]="CLOSED" && 'RS Cases'[Status Change Date]>max('Calendar'[Date]))
    )

I get this result in the table visual with the same filters on the visual (FY2025, Q2, DAHS-ISS):

Txtcher_1-1748613647214.png

The expected result should include these records:

Txtcher_2-1748613770218.png

All 3 have a status of "OPEN" and are past their Due By dates. 

 

Thank you so much! 😀 I think that worked. I will do some more testing.  

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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