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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Identify missing months in for each product

Hi All,

I have different store codes in the report. We get bill invoices almost every month. But some months are missing. How do I identify for each store, the missing month.

SushKP_0-1630495863282.png

In example above, For store ending with 578, there are no bills for November and Dec. How do I populate only rows which are missing. Is there any DAX functions which can do this or any logics behind to do it in DAX. Appreciate you help.

 

Thank you

6 REPLIES 6
Jos_Woolley
Solution Sage
Solution Sage

Might be a tad more efficient with EXCEPT:

Missing Months =
VAR TestTable =
    SUMMARIZE ( GENERATESERIES ( 1, 12 ), [Value] )
RETURN
    CALCULATE (
        CONCATENATEX (
            EXCEPT ( TestTable, VALUES ( 'Table'[Calendar Month of Year] ) ),
            [Value],
            " "
        ),
        ALL ( 'Table'[Calendar Month of Year] )
    )

Regards

Jos_Woolley
Solution Sage
Solution Sage

If you want to include the measure in a visual which also contains the Calendar Month of Year field:

Missing Months =
VAR TestTable =
    SUMMARIZE ( GENERATESERIES ( 1, 12 ), [Value] )
RETURN
    CALCULATE (
        CONCATENATEX (
            TestTable,
            IF ( NOT ( [Value] IN VALUES ( 'Table'[Calendar Month of Year] ) ), [Value] ),
            " "
        ),
        ALL ( 'Table'[Calendar Month of Year] )
    )

 Regards

Jos_Woolley
Solution Sage
Solution Sage

Hi,

Try this measure:

Missing Months =
VAR TestTable =
    SUMMARIZE ( GENERATESERIES ( 1, 12 ), [Value] )
RETURN
    CONCATENATEX (
        TestTable,
        IF ( NOT ( [Value] IN VALUES ( 'Table'[Calendar Month of Year] ) ), [Value] ),
        " "
    )

which, when placed in a simple table visual with the Store Code and Calendar Year, will provide a list of missing months for each Store/Year.

Regards

Anonymous
Not applicable

Hi Jos,

Tried your solution. The output is showing all months except month present for that row. The  month number 10 is missing in this series. Instead, can I only get number 11,12 in  the series for each store code. 

SushKP_0-1630540478117.png

This is the DAX I have used. 

Missing month =
VAR TestTable =
SUMMARIZE ( GENERATESERIES ( 1, 12 ), [Value] )
RETURN
CONCATENATEX (
TestTable,
IF ( NOT ( [Value] IN VALUES ( '__Bill By Month'[Calendar Month Of Year]) ), [Value] ),
" "
)
Fowmy
Super User
Super User

@Anonymous 

You can do it in Power Query as well.
I made a sample dataset with records missing for Apr and May for Store 100 and May for 200. I also attached the file for you.

 

Fowmy_0-1630497797050.png

Result in a new table

Fowmy_1-1630497822246.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

mahoneypat
Microsoft Employee
Microsoft Employee

The best way to do that is to create a separate Date table, make a relationship between the Date columns (1:Many from Date table to your table above), and then create a measure that returns a value if there are no rows for that month.

Creating a simple date table in DAX - SQLBI

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.