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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

Get closest value to today's date on line bar chart

I currently have a line bar chart showing today's date:

Niiru1_0-1634115376055.png

Using this measure with Date dimension and fact table:

Today maxx = 

VAR __released = MAXX( ALLSELECTED( 'Calendar'[Date] ), 'Table'[sum of values] )
VAR __disbursements = MAXX( ALLSELECTED( 'Calendar'[Date] ), 'Table'[sum of values] )

RETURN
IF(
MAX( 'Calendar'[Date] ) = TODAY(),
MAX( __released, __disbursements )
)

 

However I'm trying to return the actual value that occurs today in the tooltip (as you can see my tooltip states that it's blank because there is no value for today.

 

Niiru1_1-1634115453391.png

 

Is there a way to return the closest value with a RELATED measure or something?

 

Using pbix here:

https://www.dropbox.com/s/h9921jltwa7q44q/Set%20Limit%20of%20Future%20Appointment%20within%201%20Mon...

 

Thanks in advance.

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Check the formula.

max_not_blank = 
var max_not_blank_date = CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Date]<=TODAY()&&[sum of values]<>BLANK()))
var max_not_blank = SUMX(FILTER(ALL('Table'),'Table'[Date]=max_not_blank_date),[sum of values])
return
max_not_blank

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

5 REPLIES 5
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Check the formula.

max_not_blank = 
var max_not_blank_date = CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Date]<=TODAY()&&[sum of values]<>BLANK()))
var max_not_blank = SUMX(FILTER(ALL('Table'),'Table'[Date]=max_not_blank_date),[sum of values])
return
max_not_blank

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Anonymous
Not applicable

This is perfect! Thanks

 

One last question (if it can't be done then dont worry about it) but is there a way to have the [max_not_blank] measure return as one point/line on the date axis (like images above)

 

This is what I'm getting, the answer is correct but just trying to get it into a daily point / line

Niiru1_0-1634549036991.png

 

Many thanks again

 

Hi @Anonymous ,

 

Not quite understand. Isn't it a line now? You are using line chart, so I don't think it could be shown as points (Unless change the line color to white and show the marker as a different color). Perhaps Line and Column Chart?

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Anonymous
Not applicable

Apologies I meant a vertical line not a horizontal line, this is what I have based on your recommendation.

Niiru1_0-1634551760337.png

 

I'll continue to play with the formatting to see if I can get closer to the single point for today value.

amitchandak
Super User
Super User

@Anonymous , Based on what I got, You need to create a measure like

Today maxx =
VAR _max = MAXX( filter(ALLSELECTED( 'Calendar'[Date] ),'Calendar'[Date] <=Today())
RETURN
calculate('Table'[sum of values], filter(ALLSELECTED( 'Calendar'[Date] ),'Calendar'[Date] =_max))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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