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
vishu263
Helper II
Helper II

DAX Measure giving error

@Anonymous ,

I am trying to replicate one formula from Business Objects to Power BI DAX which reads as follows.

 

If ([Type] = "Charted") Then (If IsNull([vCountofChanges] Where([Calendar Days] >= [LeadDays])) Then 0
Else [vCountofChanges] Where([Calendar Days] >= [LeadDays]))
Else (If IsNull([vCountAllChanges] Where([Calendar Days] >= [LeadDays])) Then 0
Else [vCountofChanges] Where([Calendar Days] >= [LeadDays]))

 

I can only create a measure DAX to replicate above formula . I wrote the following DAX measure but it is giving me an errror. Can someone please correct my DAX.

 

IF(MAX('Change Requests'[Type]="Charted"),IF(ISBLANK(CALCULATE([vCountofChanges],
FILTER('Change Requests','Change Requests'[Calendar Days]>=[LeadDays]),0,CALCULATE([vCountofChanges],FILTER('Change Requests','Change Requests'[Calendar Days]>=[LeadDays]))))))

1 ACCEPTED SOLUTION

Hi @vishu263 

please try

=
IF (
MAX ( 'Change Requests'[Type] ) = "Charted",
SUMX (
VALUES ( 'Change Requests'[Calendar Days] ),
IF ( 'Change Requests'[Calendar Days] >= [LeadDays], [vCountofChanges], 0 )
)
)

View solution in original post

4 REPLIES 4
vishu263
Helper II
Helper II

Hi @tamerj1 ,

It worked perfectly 🙂 Thanks a lot for your help

tamerj1
Super User
Super User

Hi @vishu263 
Please try

=
IF (
    MAX ( 'Change Requests'[Type] ) = "Charted",
    COALESCE (
        ISBLANK (
            CALCULATE (
                [vCountofChanges],
                FILTER ( 'Change Requests', 'Change Requests'[Calendar Days] >= [LeadDays] )
            )
        ),
        0
    )
)

 

 

@tamerj1 Thanks for your quick response.

I used the DAX given by you and named it Test 2. However, its not giving me any values. Ideally, it should give me the total as 2 because there are overall 2 instances where 'Calendar days' are greater than or equal to 'LeadDays'.

Please refer to below snapshot for your reference.

 

Capture.PNG

Hi @vishu263 

please try

=
IF (
MAX ( 'Change Requests'[Type] ) = "Charted",
SUMX (
VALUES ( 'Change Requests'[Calendar Days] ),
IF ( 'Change Requests'[Calendar Days] >= [LeadDays], [vCountofChanges], 0 )
)
)

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.