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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Txtcher
Resolver I
Resolver I

Max used in True/False that is used as a table filter expression

I am using Excel power pivot/Data Model.

I have 2 tables: Date table and a RS Cases table (data table).

There are multiple relationships between the Date table and the RS Cases table so I need to use the function USERELALTIONSHIP when writing the measure.

I am trying to solve an events in progression problem. Specifically:  Total count of cases overdue each month for the past year. 

By way of explanation, if I was writing an "IF" statement it would look like this:  if Due By >=[Date_table] and Entrance Date is null or Entrance Date>Date_table, then True, else False.

 

I am getting a semantic error for the following measure and am asking for help fixing it.

Txtcher_0-1730823770740.png

Backlog2:=CALCULATE(
COUNTROWS('RS Cases'),
USERELATIONSHIP(Date_Table[Date],'RS Cases'[Due By]),
'RS Cases'[Due By]<Max(Date_Table[Date]) &&
(
ISBLANK('RS Cases'[Entrance Date]) ||
'RS Cases'[Entrance Date]>Max(Date_Table[Date])
)
)

 

Looking at this I think there are filters I do not need. Do I need Due By <Max(Date_Table[Date]) if I am using that relationship?

or the last filter for Entrance Date >Max(date_table[date])?

If I remove those filters, the error goes away but the count is not correct.

I am new to DAX measures and it is hard to wrap my head around using the date table.

Any assistance would be very much appreciated. Thanks!

2 REPLIES 2
FreemanZ
Super User
Super User

hi @Txtcher ,

 

try like:

Backlog2:=

CALCULATE(

    COUNTROWS('RS Cases'),

    USERELATIONSHIP(

        Date_Table[Date],

        'RS Cases'[Due By]

     ),

    FILTER(

    ALL('RS Cases'[Due By], 'RS Cases'[Entrance Date]),

    'RS Cases'[Due By]<Max(Date_Table[Date]) &&

      (

       ISBLANK('RS Cases'[Entrance Date]) 

        || 'RS Cases'[Entrance Date]>Max(Date_Table[Date])

    ))

)

Thank you. The measure is not producing errors, but is not producing correct data. The monthly counts are too low when I compare them with a query in which I created a custom column:  

if [Due By]<=#date(2024,9,2) and ([Entrance Date]=null or ([Entrance Date]>=#date(2024,9,2))) then "Backlog" else "Not Backlog"

When I filter this column for "Backlog," the Aug 2024 count is: 4,910.  

But the pivot has 1,066:

Txtcher_0-1730825287489.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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