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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
velvetine_123
Frequent Visitor

Display data for whole year of the selected month

Hi,

I'm looking for a chart to display the entire year monthly data based on the selected month's slicer.

I have a calendar table and a fact table. The idea is if we select April 2023, the graph shall show Jan, Feb, Mar & Apr.

If we select Oct, it will show Jan - Oct. 

Appreciate all your help on which command to use !

 

Thank you.

1 REPLY 1
FreemanZ
Community Champion
Community Champion

hi @velvetine_123 ,

 

not sure if i fully get you, supposing you have a data table like:

date sales
8/1/2022 1
9/1/2022 2
10/1/2022 3
11/1/2022 4
12/1/2022 5
1/1/2023 6
2/1/2023 7
3/1/2023 8
4/1/2023 9
5/1/2023 10
6/1/2023 11
7/1/2023 12
8/1/2023 13

 

try to:

1) add a calculated table like:

dates = 
ADDCOLUMNS(
    CALENDAR(MIN(data[date]), MAX(data[date])),
    "YYMM", FORMAT([Date], "yy/mm")
)

 

2) related dates[date] to data[date] as 1:N

 

3) plot a slicer with the yy/mm column of a calculated table like:

slicer = dates

Don't relate it with any table. 

 

4) plot a visual with dates[yy/mm] column and a measure like:

Measure = 
VAR _currentdate = MAX(dates[Date])
VAR _slicerdate = MAX(slicer[Date])
VAR _result =
IF(
    AND(
        _currentdate<=_slicerdate,
        YEAR(_currentdate)=YEAR(_slicerdate)
    ),
    SUM(data[sales])
)
RETURN _result

 

it worked like:

FreemanZ_0-1701161122122.png

 

FreemanZ_1-1701161141529.png

 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

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

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.