Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe 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.
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:
Product | Date | Value | Extra | Total |
A | Jan-20 | 40 | 37 | 77 |
A | Feb-20 | 41 | 56 | 97 |
A | Mar-20 | 55 | 15 | 70 |
A | Apr-20 | 40 | 64 | 104 |
A | May-20 | 30 | 11 | 41 |
A | Jun-20 | 40 | 23 | 63 |
A | Jul-20 | 27 | 85 | 112 |
A | Aug-20 | 23 | 60 | 83 |
A | Sep-20 | 97 | 18 | 115 |
A | Oct-20 | 72 | 93 | 165 |
A | Nov-20 | 31 | 22 | 53 |
A | Dec-20 | 50 | 97 | 147 |
Date Range Selected: Jan 2020 to Aug 2020 | ||||
Product | Date | Value | Extra | Total |
A | Jan-20 | 40 | 40 | |
A | Feb-20 | 41 | 41 | |
A | Mar-20 | 55 | 55 | |
A | Apr-20 | 40 | 40 | |
A | May-20 | 30 | 30 | |
A | Jun-20 | 40 | 40 | |
A | Jul-20 | 27 | 27 | |
A | Aug-20 | 23 | 60 | 83 |
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.
Any ideas please?
Solved! Go to Solution.
Hi @batajob ,
Based on your description, you can create a slicer and a measure as follows.
Slicer:
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:
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.
Hi @batajob ,
Based on your description, you can create a slicer and a measure as follows.
Slicer:
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:
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
79 | |
54 | |
39 | |
35 |
User | Count |
---|---|
102 | |
82 | |
48 | |
48 | |
48 |