Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all!
It feels like I am missing something very simply, but I just can't figure it out.
I have a simple last year measure for Revenue that works perfectly well all the time:
Solved! Go to Solution.
First of all, I don't know what's going on since I can't see the model. Second of all, YOU SHOULD NOT USE EXPANDED TABLES IN FILTERS. This is dangerous and slows down execution big time. Change the measures to:
LY Revenue = CALCULATE( [CY Revenue], SAMEPERIODLASTYEAR('Dropoff Date'[Date]) -- Is 'Dropoff Date' your Date table? ) CY Revenue = SUMX( RAReporting, RAReporting[Total Bill] - RAReporting[Total Bill Tax 3] - RAReporting[Damage] - RAReporting[Fines] - RAReporting[Admin Fee] ) LY Revenue (Short Term Only) = CALCULATE( [LY Revenue], KEEPFILTERS( RAReporting[LT/ST In RAReport] = "Short Term" ) )
Please stick to the rule: column names MUST BE preceded with the name of the table but measures MUST NOT.
Best
Darek
First of all, I don't know what's going on since I can't see the model. Second of all, YOU SHOULD NOT USE EXPANDED TABLES IN FILTERS. This is dangerous and slows down execution big time. Change the measures to:
LY Revenue = CALCULATE( [CY Revenue], SAMEPERIODLASTYEAR('Dropoff Date'[Date]) -- Is 'Dropoff Date' your Date table? ) CY Revenue = SUMX( RAReporting, RAReporting[Total Bill] - RAReporting[Total Bill Tax 3] - RAReporting[Damage] - RAReporting[Fines] - RAReporting[Admin Fee] ) LY Revenue (Short Term Only) = CALCULATE( [LY Revenue], KEEPFILTERS( RAReporting[LT/ST In RAReport] = "Short Term" ) )
Please stick to the rule: column names MUST BE preceded with the name of the table but measures MUST NOT.
Best
Darek
Hi Darek,
Using KEEPFILTERS() works perfectly as you suggested! Thank you so much!
'Dropoff Date' is indeed my date table.
I am not sure I understand what you mean with your two warnings of not using expanded tables in filters or using column names in measures, or where I have done either of these, but I will look up these topics online to prevent future mistakes. But thank you for the warning!
I am super happy with the solution!
Thanks
Merel
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |