cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kolumam Member
Member

Can someone help me to understand the DAX formula ?

Newly Operational in Month = IF(ISBLANK(CALCULATE(SUM(Project[Operating Size]),FILTER(ALLEXCEPT(Project,Countries[Country],'Project Phases'[Phase]),Project[COD Month] = MAX(Dates[Month])))),0,CALCULATE(SUM(Project[Operating Size]),FILTER(ALLEXCEPT(Project,Countries[Country],'Project Phases'[Phase]),Project[COD Month] = MAX(Dates[Month]))))

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-yulgu-msft
Microsoft

Re: Can someone help me to understand the DAX formula ?

Hi @Kolumam,

 

Newly Operational in Month =
IF (
    ISBLANK (
        CALCULATE (
            SUM ( Project[Operating Size] ),
            FILTER (
                ALLEXCEPT ( Project, Countries[Country], 'Project Phases'[Phase] ),
                Project[COD Month] = MAX ( Dates[Month] )
            )
        )
    ),
    0,
    CALCULATE (
        SUM ( Project[Operating Size] ),
        FILTER (
            ALLEXCEPT ( Project, Countries[Country], 'Project Phases'[Phase] ),
            Project[COD Month] = MAX ( Dates[Month] )
        )
    )
)

Based on my assumption, 'Dates' is a calendar table, maybe you added 'Dates'[Month] into a slicer, so, MAX(Dates[Month]) returns a user's selected month in slicer.

 

CALCULATE (
            SUM ( Project[Operating Size] ),
            FILTER (
                ALLEXCEPT ( Project, Countries[Country], 'Project Phases'[Phase] ),
                Project[COD Month] = MAX ( Dates[Month] )
            )
        ) 

 

This CALCULATE expression returns the total value of [Operating Size] grouped by [Country] and [Phase], meanwhile, the COD month should equals the selected month. In other words, it filters the table with the scenario where COD month=selected month, and calculate the total size per country per phase.

 

Newly Operational in Month =
IF (
    ISBLANK (
        <expression>
    ),
    0,
    <expression>
)

This means if <expression> returns blank value, display 0 as result, otherwise, display the result calculated by <expression>.

 

Reference: IF, ISBLANK, ALLEXCEPT, FILTER

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Microsoft v-yulgu-msft
Microsoft

Re: Can someone help me to understand the DAX formula ?

Hi @Kolumam,

 

Newly Operational in Month =
IF (
    ISBLANK (
        CALCULATE (
            SUM ( Project[Operating Size] ),
            FILTER (
                ALLEXCEPT ( Project, Countries[Country], 'Project Phases'[Phase] ),
                Project[COD Month] = MAX ( Dates[Month] )
            )
        )
    ),
    0,
    CALCULATE (
        SUM ( Project[Operating Size] ),
        FILTER (
            ALLEXCEPT ( Project, Countries[Country], 'Project Phases'[Phase] ),
            Project[COD Month] = MAX ( Dates[Month] )
        )
    )
)

Based on my assumption, 'Dates' is a calendar table, maybe you added 'Dates'[Month] into a slicer, so, MAX(Dates[Month]) returns a user's selected month in slicer.

 

CALCULATE (
            SUM ( Project[Operating Size] ),
            FILTER (
                ALLEXCEPT ( Project, Countries[Country], 'Project Phases'[Phase] ),
                Project[COD Month] = MAX ( Dates[Month] )
            )
        ) 

 

This CALCULATE expression returns the total value of [Operating Size] grouped by [Country] and [Phase], meanwhile, the COD month should equals the selected month. In other words, it filters the table with the scenario where COD month=selected month, and calculate the total size per country per phase.

 

Newly Operational in Month =
IF (
    ISBLANK (
        <expression>
    ),
    0,
    <expression>
)

This means if <expression> returns blank value, display 0 as result, otherwise, display the result calculated by <expression>.

 

Reference: IF, ISBLANK, ALLEXCEPT, FILTER

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors