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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors