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
AmandaL
Regular Visitor

Adding Missing Rows - need help!

Hello,
I'm trying to create a summarized table in DAX that extracts customer info from my main data table and adds in the missing rows for months based on the last date in a different calculated month column. I'll be very happy if anyone can solve this for me.

 

Here is a simplified data extract, also showing where the data in the columns has come from.  The last column ("alternative") is conditional based on the flag column (shows a different date if the flag = 1) - see last row.

Source :Orig DataOrig DataDAX ColumnPQ ColumnDAX Column
Column Name :CompanyIDFlagActive MonthAlternative Active Month
Data :Company A12340Jan-21Jan-21
 Company A12340Feb-21Feb-21
 Company A12340Mar-21Mar-21
 Company A12340Apr-21Apr-21
 Company A12340May-21May-21
 Company A12340Jun-21Jun-21
 Company A12340Jul-21Jul-21
 Company A12341Aug-21Oct-21

 

I'm trying to insert/create the "missing" rows of September and October ie. fill in the gap between the last "active month" of August and the last "alternative active month" of October. This is so I can create visuals that will recognise the flag as being active in August,  September AND October. I've been trying ADDMISSINGITEMS with SUMMARIZEDCOLUMNS but cannot get it to give the answer I need. I'm looking to ideally update just the existing "active month" column, but if instead I need to create a third date column that actually does the job that would be fine as the data set is not enormous :

CompanyIDFlagActive MonthAlternative Active MonthNEW Month Column
Company A12340Jan-21Jan-21Jan-21
Company A12340Feb-21Feb-21Feb-21
Company A12340Mar-21Mar-21Mar-21
Company A12340Apr-21Apr-21Apr-21
Company A12340May-21May-21May-21
Company A12340Jun-21Jun-21Jun-21
Company A12340Jul-21Jul-21Jul-21
Company A12341Aug-21Oct-21Aug-21
Company A12341Sep-21Oct-21Sep-21
Company A12341Oct-21Oct-21Oct-21

 

Thank-you

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

You can't do this in the same table with DAX. You have to define a new one.

 

Assuming your month columns are date type, you can define a new calculated table like this:

 

NewTable= 
    GENERATE (
        Orig,
        VAR N = DATEDIFF ( Orig[Active Month], Orig[Alternative Active Month], MONTH )
        RETURN
            SELECTCOLUMNS (
                GENERATESERIES ( 0, N ),
                "New Month", EOMONTH ( Orig[Active Month], [Value] )
            )
    )

 

View solution in original post

1 REPLY 1
AlexisOlson
Super User
Super User

You can't do this in the same table with DAX. You have to define a new one.

 

Assuming your month columns are date type, you can define a new calculated table like this:

 

NewTable= 
    GENERATE (
        Orig,
        VAR N = DATEDIFF ( Orig[Active Month], Orig[Alternative Active Month], MONTH )
        RETURN
            SELECTCOLUMNS (
                GENERATESERIES ( 0, N ),
                "New Month", EOMONTH ( Orig[Active Month], [Value] )
            )
    )

 

Helpful resources

Announcements
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.