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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
stribor45
Post Prodigy
Post Prodigy

SAMEPERIODLASTYEAR Exclude where no data

I use this function to show the data for the current date selected and the same time a year ago in my table but sometimes I don't have data for the previous period and I wonder whether I can exclude that. As you see in this image I don't have data for Sept 2021 so I would like to exclude that row from the table.

 

 

stribor45_0-1706302099383.png

 

 

 

2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@stribor45 , Try using below method

 

HasDataLastYear =
VAR PreviousYear = CALCULATE(MAX('YourTable'[Date]), SAMEPERIODLASTYEAR('YourTable'[Date]))
RETURN
IF(
NOT(ISBLANK(CALCULATE(SUM('YourTable'[YourMeasure]), 'YourTable'[Date] = PreviousYear))),
1,
0
)

 

Please accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

Anonymous
Not applicable

Hi @stribor45 ,

 

Hope all is going well.

 

To achieve your needs please follow these steps:

 

1. Create a measure that checks if the previous year's data is empty. This is done to filter out rows that have no data for the previous year.

measure = ISBLANK([Table])

 

2. After selecting the visual object, in the "Filter" pane on the right, apply measure as a filter to the current visual object. Set the filter condition to display data when the value of "measure" is FALSE.

 

If you want to learn more, please refer to the following documents:

ISBLANK function (DAX) - DAX | Microsoft Learn

 

If you have any questions or need help, please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @stribor45 ,

 

Hope all is going well.

 

To achieve your needs please follow these steps:

 

1. Create a measure that checks if the previous year's data is empty. This is done to filter out rows that have no data for the previous year.

measure = ISBLANK([Table])

 

2. After selecting the visual object, in the "Filter" pane on the right, apply measure as a filter to the current visual object. Set the filter condition to display data when the value of "measure" is FALSE.

 

If you want to learn more, please refer to the following documents:

ISBLANK function (DAX) - DAX | Microsoft Learn

 

If you have any questions or need help, please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

bhanu_gautam
Super User
Super User

@stribor45 , Try using below method

 

HasDataLastYear =
VAR PreviousYear = CALCULATE(MAX('YourTable'[Date]), SAMEPERIODLASTYEAR('YourTable'[Date]))
RETURN
IF(
NOT(ISBLANK(CALCULATE(SUM('YourTable'[YourMeasure]), 'YourTable'[Date] = PreviousYear))),
1,
0
)

 

Please accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.