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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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#]))))

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 )

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
Super User
Super User

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors