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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Result of the last date, not null and >0

Hello guys,

 

How to calculate by DAX the data filtered by the last date that is not null and >0?

On the example below, the result hoped is to replace every blanks, 0's and numbers to 784,10.

 

Luan97_1-1609938783460.png

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , Try measure like

 

lastnonblankvalue(Table[Date], [Valore])

or

calculate(lastnonblankvalue(Table[Date], [Valore]), allexcept(Table, Table[part_number_sem#]))

or


measure = calculate([Valore], filter(Table,Table[Date] = calculate(max(Table[Date]), allexpcept(Table,table[part_number_sem#]))))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Not working... I tried to measure like

 

VAR CurrentName = SELECTEDVALUE(Table[PART_NUMBER_SEM_#])
RETURN
MAXX(
FILTER(ALL(Table),Table[PART_NUMBER_SEM_#]=CurrentName),Table[Valor])
 
This to result hoped but with Valor = 784,10 because it's the valor of the last date that is not null neither 0.
796.PNG

@Anonymous , Try like

Measure =
VAR __id = MAX ('Table'[PART_NUMBER_SEM_#] )
VAR __date = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[PART_NUMBER_SEM_#] = __id )
CALCULATE ( [Valor] , VALUES ('Table'[PART_NUMBER_SEM_# ),'Table'[PART_NUMBER_SEM_#] = __id,'Table'[Date] = __date )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak

Firstly I thank you for the disposition to help me with this problem.

However, it didn't work as well...

 

Teste2.PNG

 

Obs.: I just renamed the "Measure" to "Val_Com"

 

AlB
Community Champion
Community Champion

Hi @Anonymous 

What is the code for the [Valor] measure?

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

Anonymous
Not applicable

I used a divide and average function based on sale.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.