This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
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.
Solved! Go to Solution.
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] )
)
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
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] )
)
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
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 27 | |
| 26 | |
| 22 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 45 | |
| 43 | |
| 41 | |
| 21 | |
| 20 |