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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Tlotly
Resolver II
Resolver II

Bar chart displaying 24 months instead of 12 months

Hello

 

Can you please assist. I have a bar chart that displays a measure by yearmonth and I have 2 years worth of data on the report. If I haven't selected the year it shows all the 2 years, like below.

Tlotly_2-1625148876144.png

 

I need to default the dashboard to show only the latest year and month on the data, without the user selecting the year on a slicer:

Tlotly_1-1625148854258.png

I've tried doing it just for the year on the measure but it's still not displaying correctly (still displays 24 months), how do I go about this? Below is the current measure:

          ErrorsCY = CALCULATE(sum('Branch Scores'[Nr Errors]),
                 FILTER(all('Calendar'[Fiscal Year]),'Calendar'[Fiscal Year] = max('Calendar'[Fiscal Year])
                            ))
 
Thank you in advance
Matlotlo
2 REPLIES 2
Tlotly
Resolver II
Resolver II

Thank you @Anonymous , but I'm still not getting the results I want. The expression works only when I select a year, see below: and I modified the DAX a bit to suit my needs:

     Measure =

         var MaxYear = max('Calendar'[Fiscal Year])

RETURN

          IF(SELECTEDVALUE('Calendar'[Fiscal Year]) = MaxYear, sum('Branch Scores'[Nr Errors]),

             CALCULATE(sum('Branch Scores'[Nr Errors]),

         FILTER('Calendar','Calendar'[Fiscal Year] = max('Calendar'[Fiscal Year])

)

))

 

Tlotly_0-1625579520292.png

 

Then when I deselect the year, I still get 2020 figures on the matrix even though I've specified on the DAX to give me results just for the max year which in this case is 2021. What am I doing wrong?

Tlotly_1-1625579767062.png

 

 

 

Anonymous
Not applicable

Hi @Tlotly 

I create a sample ,maybe you can refer to it .

Original data:

Ailsamsft_0-1625465833401.png

Then create a measure to return the latest data .

the latest year = CALCULATE(SELECTEDVALUE('Table'[Value]),FILTER('Table',YEAR(SELECTEDVALUE('Table'[Date]))=YEAR(TODAY())))

The effective is as shown (add the measure and date into a bar chart):

Ailsamsft_1-1625465833405.png

Ailsamsft_2-1625465833408.png

Best Regards

Community Support Team _ Ailsa Tao

 

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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