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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Show only LAST NON BLANK value in Cards

Hello All,

I have a table as below

6.PNG

 

I have written below calculated column to get the last non blank value from column B

c = 
var temp = Table1[A]
return CALCULATE(LASTNONBLANK(Table1[B],Table1[B]),ALL(Table1),Table1[A]<=temp)

And it gives me

7.PNG

 

But when i used a card visual on this c calculated column

it is showing the all sum of values i.e 14

I would like to show a card visual which can only show the value of LAST NON BLANK from column B i.e value 3.

 

Any suggestions please.

Mohan V

 

 

1 ACCEPTED SOLUTION
v-sihou-msft
Microsoft Employee
Microsoft Employee

@Anonymous

 

When you put a field into a Card Visual, it will be aggregated. In this scenario, you need to create a measure instead of calculated column. You need to calculate the LastNonBlankDate first, then use it to get the corresponding column B. Please refer to DAX below:

 

LastNonBlank B = 
var LastNonBlankDate=CALCULATE(MAX(Table1[Date]),FILTER(ALL(Table1),Table1[Date]<=MAX(Table1[Date]) && Table1[B]<>0))
return
CALCULATE(SUM(Table1[B]),
	FILTER(ALL(Table1),Table1[Date]=LastNonBlankDate)
)

5555.PNG

 

 

Regards,

View solution in original post

5 REPLIES 5
v-sihou-msft
Microsoft Employee
Microsoft Employee

@Anonymous

 

When you put a field into a Card Visual, it will be aggregated. In this scenario, you need to create a measure instead of calculated column. You need to calculate the LastNonBlankDate first, then use it to get the corresponding column B. Please refer to DAX below:

 

LastNonBlank B = 
var LastNonBlankDate=CALCULATE(MAX(Table1[Date]),FILTER(ALL(Table1),Table1[Date]<=MAX(Table1[Date]) && Table1[B]<>0))
return
CALCULATE(SUM(Table1[B]),
	FILTER(ALL(Table1),Table1[Date]=LastNonBlankDate)
)

5555.PNG

 

 

Regards,

Hi, how would you do the same thing but having 2 tables? I have the same problem but i have my date table apart from my dataset. Actually, im using this dax measure but now been october it doesn't show me the value of this month, it show's me the previous one.

dataset

agustiny_0-1634068855917.png

 

 

hi @v-sihou-msft 

 

thanks it works perfectly for me.

I just need that to work on a more filtered context, with my products filtered.

Currently, your measure is returning the value of a sum for all products, whatever product is filtered. How to make it specific to each product ?

 

is it something like :

LastNonBlank B = 
var LastNonBlankDate=CALCULATE(MAX(Table1[Date]),FILTER(ALL(Table1),Table1[Date]<=MAX(Table1[Date]) && Table1[B]<>0))
return
CALCULATE(SUMX(Table1[B],(Table1[Products]),
	FILTER(ALL(Table1),Table1[Date]=LastNonBlankDate)
) 

 Thanks !

to access to dataset : 

 

https://1drv.ms/u/s!AkOv33tEaCSwpH1X-dYFZx5dNfXe

 

your measure is in the dataset with same name

Greg_Deckler
Super User
Super User

I'm not sure what all of the other DAX is about, but I believe what you are going for is:

 

Measure = LASTNONBLANK(Table1[B],[B])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.