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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
HLVW
Helper I
Helper I

Measure for LY that ignores select filter

Hi.
 
I am trying to calculate a measure for a matrix, showing total LY figures. I have 2 slicers, Month & Year. If I select f.ex. 2024 and month May, I would like the new measure to show full 2023 and not only YTD May 2023.
I have tried with ALLEXCEPT, but with no luck....
Current measure: LY Full year = CALCULATE(-SUM('Finance Transactions_V'[Amount]), SAMEPERIODLASTYEAR(Date_V[Date]),ALLEXCEPT(Date_V, Date_V[Year Number]))
 
Thanks a lot in advance.
1 ACCEPTED SOLUTION
_AAndrade
Super User
Super User

Hi,

 

Please try this:

VAR Year = MAX(Date_V[Year Number])

RETURN

CALCULATE(
    "Your Sum Measure",
    REMOVEFILTERS(Date_V),
    DATESBETWEEN(Date_V[Date],DATE(Year -1,1,1),DATE(Year -1,12,31))
)






Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




View solution in original post

4 REPLIES 4
_AAndrade
Super User
Super User

Hi,

 

Please try this:

VAR Year = MAX(Date_V[Year Number])

RETURN

CALCULATE(
    "Your Sum Measure",
    REMOVEFILTERS(Date_V),
    DATESBETWEEN(Date_V[Date],DATE(Year -1,1,1),DATE(Year -1,12,31))
)






Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




It works perfectly! Thanks a lot.

danextian
Super User
Super User

Hi @HLVW ,

Do you intend to show the value for each past x months as well and not just the correct selected month? You will need a disconnected dates/calendar table for that as using the one related to your fact table will just show what is selected. Please see attached sample pbix.

danextian_0-1711448092887.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thanks a lot for your reply. I would like a matrix visual as below, where the right column is full last year in spite of filters. I already have a date table, but this is connected...

HLVW_0-1711448454771.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Top Kudoed Authors