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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
GilbertQ
Super User
Super User

Get LastNonBlank Value across all rows

Hi there I wonder if someone could help me out.

 

If you can refer to the image below.

 

LastNonBlank.png

What I want is the Value from the ZCALC Rowz (30/06/2019) to be repeated. As is shown the the example in the ZCALC ROwz column (1/07/2020)

 

The trick here is that I have got a Fiscal Year Slicer, so if I click on Fiscal Year 2019-20 then I want the repeated value to change from 30/06/2019 to be 30/06/2020 for all the rows in the table.

 

Any help or suggestions will be appreciated.

 





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

Proud to be a Super User!







Power BI Blog

1 ACCEPTED SOLUTION

Hi @tringuyenminh92 I managed to figure it out

 

Here is the code that I used to return to me the values selected from the Fiscal Year Slicer

 

ZCALC ROwz2 =
CALCULATE (
    CALCULATE ( COUNTROWS ( 'TYOY' )ALLSELECTED ( 'Date'[Fiscal Year] ) ),
    ALLSELECTED ( 'Date' )
)





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

Proud to be a Super User!







Power BI Blog

View solution in original post

4 REPLIES 4
tringuyenminh92
Memorable Member
Memorable Member

Hi @GilbertQ,

 

I'm sorry but i'm trying to understand your case correctly. Could you please provide the picture of whole report you want and data table with Fields in chart? If there is no sensitive information, you could share current pbix file. So I could quicky understand and help you.

Hi @tringuyenminh92 I managed to figure it out

 

Here is the code that I used to return to me the values selected from the Fiscal Year Slicer

 

ZCALC ROwz2 =
CALCULATE (
    CALCULATE ( COUNTROWS ( 'TYOY' )ALLSELECTED ( 'Date'[Fiscal Year] ) ),
    ALLSELECTED ( 'Date' )
)





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

Proud to be a Super User!







Power BI Blog

It's good to hear that. Another way to get current selected in slicer is using FirstNonBlank( Values( filter column),1)

That does work, but when you have all your dates in the table, it shows all the dates in their row context. So whilst that would work if there was no Fiscal Year in the rows, in my dataset there was. So for each row the FirstNonBlank Date in the row context is the Fiscal Year.





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

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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