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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper III

## How to only show the latest numbers on a line chart?

Hello everyone!

I created a line chart in power bi desktop but I only want to show the latest numbers. Can anyone show me how to do that please?

Original chart has all numbers showing for each month

The result I'm hoping to achieve (below is from excel that I was able to delete the numbers from previous month mannually):

Thank you in advance for your help!

4 ACCEPTED SOLUTIONS
Super User

Create the two measure above.

I hope I have been helpful.
Mark it as a solution if resolve your problem.

Ciao!

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Super User

Foglio1 is the table [data] is the field of the calendar date.
in italian DATA is DATE.

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Super User
Replace the refer of the date to the new field of the new table like this:

Max Data =
CALCULATE(
MAX(Table1[Startofmonth])
,ALL(Table1)
)
--------
Color =
IF(MAX(Table1[Startofmonth]) = [Max Data]"#000000""#FFFFFF00")

I hope I have been helpful.
Mark it as a solution if resolve your problem.

Ciao!

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Super User

Yes in ALL and ALLSELECTED formula there is the solution if you have a date table with futures dates.

I'm happy I have been helpful.
Mark it as a solution if resolve your problem.

Ciao!

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
19 REPLIES 19
Super User

My fault, I missing double quotes and i use white instead of transparent.
Here is correct with two measure:

-----
Max Data =
CALCULATE(
MAX(Foglio1[Data])
,ALL(Foglio1)
)
--------
Color =
IF(MAX(Foglio1[Data]) = [Max Data], "#000000", "#FFFFFF00")
Then pass Color to conditional formatting.
Here the pbix link
https://we.tl/t-pJTAEJYuTv

I hope I have been helpful.
Mark it as a solution if resolve your problem.

Ciao!

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Helper III

Hi Lucadelicio,

Thanks for your fast reply. Do you mind sharing with me a screenshot of your pbix? my company blocked the site you sent me.

Super User

Create the two measure above.

I hope I have been helpful.
Mark it as a solution if resolve your problem.

Ciao!

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Helper III

Hi Lucadelico,

Sorry to bother you again.. do you mind expanding the data table so I can see what column you are referring to in your dax please? I got a bit confused by foglio1[data]

Super User

Foglio1 is the table [data] is the field of the calendar date.
in italian DATA is DATE.

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Super User

send me your mail in private message please

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Super User

Try to use the conditional formatting passing a measure that returns the color with the condition in wich date it will be.
MEASURE =
var _maxdate =
CALCULATE(
MAX(Sales[date])
,ALL(Sales)
)
RETURN
IF(_maxdate < MAX(Sales[date]), #FFFFFF, #000000)
I use white and black.
White i think is the color of your background.

I hope I have been helpful.
It's more easier to help you if you upload your pbix.
Mark it as a solution if resolve your problem.

Ciao!

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Helper III

Hi Lucadelicio,

I tried to reply to your PM but the system said I reached the maximum number of pm so I couldn't send it.

I have a follow up question.

I've got two tables, one transaction table and one calendar table. See below.

I created relationship by linking 'calendar date' with 'Date'. I want to use 'start of month' in X-axis in the line chart. In this case, how should I modify the dax you created?

Table 1 is the calendar table (I didn't write out all dates)

 Calendar date start of month 5/1/2022 5/1/2022 5/2/2022 5/1/2022 5/3/2022 5/1/2022 6/1/2022 6/1/2022 6/2/2022 6/1/2022

Table 2 shows transactions

 Date A B C D E 5/1/2022 3 7 21 21 5/2/2022 \$5 \$9 \$10 \$45 \$50 5/3/2022 \$15 \$12 \$18 \$34 \$35 6/1/2022 \$20 \$16 \$22 \$28 \$34 6/2/2022 \$12 \$30 \$25 \$45 \$60
Super User
Replace the refer of the date to the new field of the new table like this:

Max Data =
CALCULATE(
MAX(Table1[Startofmonth])
,ALL(Table1)
)
--------
Color =
IF(MAX(Table1[Startofmonth]) = [Max Data]"#000000""#FFFFFF00")

I hope I have been helpful.
Mark it as a solution if resolve your problem.

Ciao!

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Helper III
Hi Lucadelicio,
Sorry for the delayed reply. I took some time to try the Dax you sent me. I twisted it a little bit and it worked!!! Instead of using ALL, I used ALLSELECTED. I also watched a youtube video from Curbal (Title of the video: DAX Fridays! #184:Show last label only on a line chart in Power BI) and got some inspiration from there in combination of your dax 🙂

Thank you very much for taking the time to help me! I had been stucked with this issue for over 3 weeks and finally solved it! :') I really appreciate your patience in explaining all this to me and your help on this means a lot to me!!! Graize mille!!
Super User

Yes in ALL and ALLSELECTED formula there is the solution if you have a date table with futures dates.

I'm happy I have been helpful.
Mark it as a solution if resolve your problem.

Ciao!

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Helper III

If I use  MAX(Table1[Startofmonth]), it will be december 1st because my calendar table goes up to december. However, my transaction table only has data from most current month.

Super User

Send me in email the fake pbix that rappresent your situation and I will fix tou

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Helper III
Hi Lucadelicio, Thanks for your help. I tried your dax in power bi but it didn't work. There are red lines on and after the word 'Return'. Do you know where I did wrong? (I copied your dax and replaced the fields with the field in my tables)
Super User

can you share the pbix. It's easier to help you.

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Helper III

I'm sorry I can't share it due to company privacy policy

Super User

share me a excel seample fake data.
So i can try on your dataset.

Luca D'Elicio

https://www.linkedin.com/in/luca-d-elicio-74a481158/
Helper III

The table shows the data used for creating the first chart in my original post

Helper III
 A B C D E Total 5/1/2022 3 7 21 21 52 6/1/2022 \$5 \$9 \$10 \$45 \$50 \$119 7/1/2022 \$15 \$12 \$18 \$34 \$35 \$114 8/1/2022 \$20 \$16 \$22 \$28 \$34 \$120 9/1/2022 \$12 \$30 \$25 \$45 \$60 \$172

## Helpful resources

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Join our Community Sticker Challenge

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

#### Power BI Monthly Update - July 2024

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

#### Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors