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

Measure (LY variation)

Hi all, 

 

Could somebody please help me to do the Last Year variation of the following measure? :

 

NrCases Payment&NOFee = 
COUNTROWS(
    EXCEPT(
        FILTER(
            DISTINCT (Financial_Combined[Job No.]);
            CALCULATE ( SUM (Financial_Combined[Amount Paid]))>0
        );
        FILTER (
            DISTINCT (Fees[CaseID]);
            CALCULATE (SUM (Fees[FeeAmount]))>0
        )
    )
)

 

 

I have tried with: 

 

NrCases Payment&NOFee LY =
COUNTROWS (
    EXCEPT (
        FILTER (
            DISTINCT ( Financial_Combined[Job No.] );
            CALCULATE (
                SUM ( Financial_Combined[Amount Paid] );
                SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
            ) > 0
        );
        FILTER (
            DISTINCT ( Fees[CaseID] );
            CALCULATE (
                SUM ( Fees[FeeAmount] );
                SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
            ) > 0
        )
    )
)

 

 

 

but this gives me blank results.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Measure (LY variation)

Hi @setis 

 

If I remember your data model correctly, you'll probably need something like the following. Do bear in mind that for time intelligence functions to work properly, the date table should always have complete years and contain all the dates that you need. I.e. if you have a date table from 01/01/2017 on,  SAMEPERIODLASTYEAR(anything in 2017) will return blank since the date table has no dates in 2016.

In any case, why not just use the date table to select the year you want?

 

NrCases Payment&NOFee =
CALCULATE (
    COUNTROWS (
        EXCEPT (
            FILTER (
                DISTINCT ( Financial_Combined[Job No.] );
                CALCULATE ( SUM ( Financial_Combined[Amount Paid] ) ) > 0
            );
            FILTER ( DISTINCT ( Fees[CaseID] ); CALCULATE ( SUM ( Fees[FeeAmount] ) ) > 0 )
        )
    );
    SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
)

View solution in original post

Highlighted
Super User
Super User

Re: Measure (LY variation)

@setis 

 

You can always create a second measure based on the first one for the last year, i.e., you have the initial measure:

 

NrCases Payment&NOFee =
COUNTROWS (
    EXCEPT (
        FILTER (
            DISTINCT ( Financial_Combined[Job No.] );
            CALCULATE ( SUM ( Financial_Combined[Amount Paid] ) ) > 0
        );
        FILTER ( DISTINCT ( Fees[CaseID] ); CALCULATE ( SUM ( Fees[FeeAmount] ) ) > 0 )
    )
)

and then, based on that:

 

NrCases Payment&NOFee LY =
CALCULATE ( [NrCases Payment&NOFee]; SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) )

It's probably neater.

 

Cheers

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Measure (LY variation)

Hi @setis 

 

If I remember your data model correctly, you'll probably need something like the following. Do bear in mind that for time intelligence functions to work properly, the date table should always have complete years and contain all the dates that you need. I.e. if you have a date table from 01/01/2017 on,  SAMEPERIODLASTYEAR(anything in 2017) will return blank since the date table has no dates in 2016.

In any case, why not just use the date table to select the year you want?

 

NrCases Payment&NOFee =
CALCULATE (
    COUNTROWS (
        EXCEPT (
            FILTER (
                DISTINCT ( Financial_Combined[Job No.] );
                CALCULATE ( SUM ( Financial_Combined[Amount Paid] ) ) > 0
            );
            FILTER ( DISTINCT ( Fees[CaseID] ); CALCULATE ( SUM ( Fees[FeeAmount] ) ) > 0 )
        )
    );
    SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
)

View solution in original post

setis Member
Member

Re: Measure (LY variation)

Hi @AlB,

 

Thanks again!!

 

I needed the LY measure for a KPI card Smiley Happy

Highlighted
Super User
Super User

Re: Measure (LY variation)

@setis 

 

You can always create a second measure based on the first one for the last year, i.e., you have the initial measure:

 

NrCases Payment&NOFee =
COUNTROWS (
    EXCEPT (
        FILTER (
            DISTINCT ( Financial_Combined[Job No.] );
            CALCULATE ( SUM ( Financial_Combined[Amount Paid] ) ) > 0
        );
        FILTER ( DISTINCT ( Fees[CaseID] ); CALCULATE ( SUM ( Fees[FeeAmount] ) ) > 0 )
    )
)

and then, based on that:

 

NrCases Payment&NOFee LY =
CALCULATE ( [NrCases Payment&NOFee]; SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) )

It's probably neater.

 

Cheers

View solution in original post

setis Member
Member

Re: Measure (LY variation)

OMG, of course. I had a very long day today. Smiley Happy

Thanks!

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 178 members 2,047 guests
Please welcome our newest community members: