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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

A function "FILTER" has been used in a True/False expression

Hi, 

Need help on this formula. Thought I was doing the DAX correctly.. but got an "error" - A function "FILTER" has been used in a True/False expression .

 

Any suggestion on the correct fomula. Thanks a bunch. 

 

I want to calculate the cumulative progress with an IF condition. 

 

Measure:
RL **bleep** CP Prog =

CALCULATE(
SUMX('09 CP filter', '09 CP filter'[RL_CP]),
IF('09 CP filter'[Field]="P",
AND(
FILTER(ALL('09 CP filter'), SUMX(FILTER('09 CP filter', EARLIER('09 CP filter'[ID])='09 CP filter'[ID]), '09 CP filter'[RL_CP])),
FILTER(ALLEXCEPT('09 CP filter', '09 CP filter'[Tag]), '09 CP filter'[Overall Code]<=MAX('09 CP filter'[Overall Code]))),
FILTER(
ALLEXCEPT('09 CP filter', '09 CP filter'[Tag]), '09 CP filter'[Overall Code]<=MAX('09 CP filter'[Overall Code]))
))

 

Thanks.

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous 

You could try the following measure:

RL **bleep** CP Prog2 =
VAR test1 =
    CALCULATE (
        SUMX ( '09 CP filter', '09 CP filter'[RL_CP] ),
        FILTER (
            ALL ( '09 CP filter' ),
            SUMX (
                FILTER ( '09 CP filter', EARLIER ( '09 CP filter'[ID] ) = '09 CP filter'[ID] ),
                '09 CP filter'[RL_CP]
            )
        ),
        FILTER (
            ALLEXCEPT ( '09 CP filter', '09 CP filter'[Tag] ),
            '09 CP filter'[Overall Code] <= MAX ( '09 CP filter'[Overall Code] )
        )
    )
VAR test2 =
    CALCULATE (
        SUMX ( '09 CP filter', '09 CP filter'[RL_CP] ),
        FILTER (
            ALLEXCEPT ( '09 CP filter', '09 CP filter'[Tag] ),
            '09 CP filter'[Overall Code] <= MAX ( '09 CP filter'[Overall Code] )
        )
    )
VAR field =
    CALCULATE (
        MAX ( '09 CP filter'[Field] ),
        FILTER (
            ALL ( '09 CP filter' ),
            '09 CP filter'[ID] = MAX ( '09 CP filter'[ID] )
                && '09 CP filter'[Field] = MAX ( '09 CP filter'[Field] )
        )
    )
VAR test3 =
    IF ( field = "P"test1test2 )
RETURN
    test3

 

 

Hope it is helpful for you!

 

Best Regard

Lucien Wang

View solution in original post

7 REPLIES 7
v-luwang-msft
Community Support
Community Support

Hi @Anonymous 

You could try the following measure:

RL **bleep** CP Prog2 =
VAR test1 =
    CALCULATE (
        SUMX ( '09 CP filter', '09 CP filter'[RL_CP] ),
        FILTER (
            ALL ( '09 CP filter' ),
            SUMX (
                FILTER ( '09 CP filter', EARLIER ( '09 CP filter'[ID] ) = '09 CP filter'[ID] ),
                '09 CP filter'[RL_CP]
            )
        ),
        FILTER (
            ALLEXCEPT ( '09 CP filter', '09 CP filter'[Tag] ),
            '09 CP filter'[Overall Code] <= MAX ( '09 CP filter'[Overall Code] )
        )
    )
VAR test2 =
    CALCULATE (
        SUMX ( '09 CP filter', '09 CP filter'[RL_CP] ),
        FILTER (
            ALLEXCEPT ( '09 CP filter', '09 CP filter'[Tag] ),
            '09 CP filter'[Overall Code] <= MAX ( '09 CP filter'[Overall Code] )
        )
    )
VAR field =
    CALCULATE (
        MAX ( '09 CP filter'[Field] ),
        FILTER (
            ALL ( '09 CP filter' ),
            '09 CP filter'[ID] = MAX ( '09 CP filter'[ID] )
                && '09 CP filter'[Field] = MAX ( '09 CP filter'[Field] )
        )
    )
VAR test3 =
    IF ( field = "P"test1test2 )
RETURN
    test3

 

 

Hope it is helpful for you!

 

Best Regard

Lucien Wang

amitchandak
Super User
Super User

@Anonymous , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Anonymous
Not applicable

Hi @amitchandak , sorry how to attach a file? 

@Anonymous , Upload to onedrive or dropbox and share the link

Anonymous
Not applicable

Hi @amitchandak , Sorry I think I confused you a bit. I want the end result to be column N. 

Scenario, if column F is filtered with "P", although column E are the same, cumulative progress should be calculated by grouped of column E and column K with max of column L., else, just calculate cumulative progress by column E and max of column L. 

Anonymous
Not applicable

@amitchandak Thanks for the info, Sorry those arent allowed in this PC.

Here is the screenshot od my data. 

 

Basically I want to achieve the Cumm Prog % at Column N.

J7460_0-1613536654813.png

 

Thanks again. 

 

@Anonymous , You need equal columns like the 2nd column with = to join on max and incremental column like a first column or overall code

 

and you need a measure like

calculate([RL CP%], filter(allselected(Table), Table[Col] = max(Table[Col]) && Table[Col2] <= max(Table[Col2])))

 

Use correct column in place col and col2

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.