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
fjjohann
Frequent Visitor

Caluculation Quote Between Dates and Consider Product

Hello,

 

My Table contain 3 columns

[Date] [Ativo] [Value]

 

There are no [Value] per [Ativo] for all [Date]

 

I need one Mesure:

 

Show the [Value] according to the [Date] selected in the Dashboard.
If a date set is selected in the dashboard (such as a Month), show the last value.
And when there is no value for the [Ativo] on the selected date, it should show the value of the last existing date.

 

Logically the measure must take into consideration the [Ativo].

1 ACCEPTED SOLUTION

Perfect,

 

guess this measure will provide what you are looking for

lastvalue = 
CALCULATE(
	LASTNONBLANK(Cotacao[Cot], sum(Cotacao[Cot])
	) 
)

a slight variation will provide the last date

lastdate = 
CALCULATE(
	LASTNONBLANK('Cotacao'[Data], sum(Cotacao[Cot])
	) 
)

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

6 REPLIES 6
TomMartens
Super User
Super User

And another question, does your model just contain that one table you mentioned or do you also use a separate date table?



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

This is the Table with Values

 

Tab Cot.PNG

 

And i Have a Calendar Table.

 

The measure must calculate the last [Cot] of each [Ativo] according to the Date selected in the Dashboard.

If it's a Month or Year or All, you should look for the last [Cot].

If there is no [Cot] for the Data and [Asset] selected, you should search for the last one.

 

Hey,

 

thanks for the sharing a screenshot, maybe you will find some time to provide sample data that can be easily recreated by the people here in the community (downloadable (pbix, xlsx or csv), this will safe me a lot of time during the weekend and prevents issues with insufficient sample data.

 

Thanks



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Perfect,

 

guess this measure will provide what you are looking for

lastvalue = 
CALCULATE(
	LASTNONBLANK(Cotacao[Cot], sum(Cotacao[Cot])
	) 
)

a slight variation will provide the last date

lastdate = 
CALCULATE(
	LASTNONBLANK('Cotacao'[Data], sum(Cotacao[Cot])
	) 
)

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
TomMartens
Super User
Super User

Hey,

 

please prepare sample data and share a link to pbix, excel, csv.

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.