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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

How to show completed months

I have a Year slicer where you can select the different years. I also have a table which shows the months/year / sales

 

When I select a year i want it to show me all months and all sales, even if the month didn't have a sale in, however atm I am only getting the months that have a sale in. I added a +0 to my measure but when I do this and select current year it gives me future months too. Example below, I selected 2022 I want it to show me jan, feb and march but its only showing Jan and March.

 

Closed - No of Closed Locations = CALCULATE(Count(customer[id]),USERELATIONSHIP(customer[CLOSED_DATE_UTC],'Date'[Date]))
 

PBChecking01_0-1651259702213.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

You need create a Calendar Date table that contains all the months .Then compare the Calendar Date table with original data table .If the month is not in original data table , return 0 .If the month is in original data table ,return the value from original table .I created a sample , you can have a look .

(1)Create a Calendar Date table with column [Year] [Month] [Month No] , add a slicer with column ‘Calendar Date’ [Year]

Calendar Date = DISTINCT( SELECTCOLUMNS( CALENDAR(DATE(2021,01,01),DATE(2022,12,31)),"Year",YEAR([Date]), "Month",FORMAT([Date],"mmmm"),"Month Number", MONTH([Date])))

You will get a result like this :

Ailsamsft_0-1651649668789.png

(2)Create a measure to compare these two tables to return the value or 0 .

Measure = CALCULATE(SUM('Table'[Sales]),FILTER('Table',[Year]=MAX('Calendar Date'[Year]) && [Month]=MAX('Calendar Date'[Month])))+0

(3)Sort by month

Ailsamsft_1-1651649668792.png

The final result is as shown below .

Ailsamsft_2-1651649668795.pngAilsamsft_3-1651649668797.png

I have attached my pbix file , you can refer to it .

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous 

You need create a Calendar Date table that contains all the months .Then compare the Calendar Date table with original data table .If the month is not in original data table , return 0 .If the month is in original data table ,return the value from original table .I created a sample , you can have a look .

(1)Create a Calendar Date table with column [Year] [Month] [Month No] , add a slicer with column ‘Calendar Date’ [Year]

Calendar Date = DISTINCT( SELECTCOLUMNS( CALENDAR(DATE(2021,01,01),DATE(2022,12,31)),"Year",YEAR([Date]), "Month",FORMAT([Date],"mmmm"),"Month Number", MONTH([Date])))

You will get a result like this :

Ailsamsft_0-1651649668789.png

(2)Create a measure to compare these two tables to return the value or 0 .

Measure = CALCULATE(SUM('Table'[Sales]),FILTER('Table',[Year]=MAX('Calendar Date'[Year]) && [Month]=MAX('Calendar Date'[Month])))+0

(3)Sort by month

Ailsamsft_1-1651649668792.png

The final result is as shown below .

Ailsamsft_2-1651649668795.pngAilsamsft_3-1651649668797.png

I have attached my pbix file , you can refer to it .

Anonymous
Not applicable

Hi, 

as dhruvinushah said you need to flag "Show Items with no data" but by doing that it will sowh also future months if present in the data dimension.
What you could do is to create a calculated column on the date calendar:

IsClosedMonth = IF(FORMAT(TODAY(), "yyyyMM") > FORMAT('Date'[Date], "yyyyMM"),
"Closed",
"Not Closed"
)

Once the calculated column has been added use it as a filter on the visual:

marisolmarch_2-1651325667592.png

 

Hope this is what you are looking for.

dhruvinushah
Responsive Resident
Responsive Resident

RIght click on the field in the Visualizations pane, select "Show Items with no data" 

dhruvinushah_0-1651261656343.png


This should fix your problem.










Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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