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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
batajob
New Member

Select the latest value in a filtered visual and add the last value in a graph

Hi folks

 

I have a troublesome challenge... Using a filter on a Power BI visual to select a range of dates. For the last date in a visual, I want to add a value, for the others I don't.

 

I've created a sample file to show the issue: sample file download 

 

Raw data as follows:

ProductDateValueExtraTotal
AJan-20403777
AFeb-20415697
AMar-20551570
AApr-204064104
AMay-20301141
AJun-20402363
AJul-202785112
AAug-20236083
ASep-209718115
AOct-207293165
ANov-20312253
ADec-205097147

 

Date Range Selected: Jan 2020 to Aug 2020 
     
ProductDateValueExtraTotal
AJan-2040 40
AFeb-2041 41
AMar-2055 55
AApr-2040 40
AMay-2030 30
AJun-2040 40
AJul-2027 27
AAug-20236083

 

You can see that I am adding the 60 from the "Extra" column to the value for August-20 but not adding any other values from the "Extra" column for earlier months in the selected range. Ideally, I would then show this in a graph.

 

graph.jpg

Any ideas please?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @batajob ,

Based on your description, you can create a slicer and a measure as follows.

Slicer:

v-yuaj-msft_0-1610931422424.png

 

Measure:

last value_test =

var x1=CALCULATE(MAX('data'[Date]),ALLSELECTED(data[Date]))

return

IF(MAXX('data',[Date])=x1,MAX('data'[Extra]))+MAX('data'[Value])

 

Result:

v-yuaj-msft_1-1610931422434.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @batajob ,

Based on your description, you can create a slicer and a measure as follows.

Slicer:

v-yuaj-msft_0-1610931422424.png

 

Measure:

last value_test =

var x1=CALCULATE(MAX('data'[Date]),ALLSELECTED(data[Date]))

return

IF(MAXX('data',[Date])=x1,MAX('data'[Extra]))+MAX('data'[Value])

 

Result:

v-yuaj-msft_1-1610931422434.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much for your assistance with this. The solution works great and is very elegant.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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