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

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

Reply
kkalyanrr
Helper V
Helper V

Adding rows using DAX expression based on condition

Hello Team ,

I'm trying to project forecast for the coming months based on end date , if the difference amount is >2000 I'm splitting in to next coming months. My requirement is to add a new Forecast Date column and add rows of coming months.
How can I acheive this.
Here is the dataset , forecast date is custom column I've created..

Q4.JPG

 

I'm expecting output like the attached pic.

Q3.JPG

2 ACCEPTED SOLUTIONS

HI @kkalyanrr 

 

You can create a table like below, or see the attached for reference.

Table 2 = 
VAR __tbl = 'Table'
VAR __date = TODAY()
VAR __forecastDate1 =
    DATE( YEAR( __date ), MONTH( __date ), 1 )  
VAR __forecastDate2 =
    DATE( YEAR( __date ), MONTH( __date ) +1, 1 )  
VAR __forecastDate3 =
    DATE( YEAR( __date ), MONTH( __date ) +2, 1 ) 
VAR __baseTbl = ADDCOLUMNS( __tbl, "Forecast Date", __forecastDate1 )
VAR __forecastDateTbl = { __forecastDate2, __forecastDate3 }
VAR __filterTbl = 
    FILTER( __tbl, 'Table'[Acc Total] > 2000 )
RETURN 
    UNION(
        __baseTbl,
        CROSSJOIN( __filterTbl, __forecastDateTbl )
    )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

Icey
Community Support
Community Support

Hi @kkalyanrr ,

 

Modify @Mariusz 's expression like so:

Table 2 = 
VAR __tbl = 'Table'
VAR __date = TODAY()
VAR __forecastDate1 =
    DATE( YEAR( __date ), MONTH( __date ), 1 )  
VAR __forecastDate2 =
    DATE( YEAR( __date ), MONTH( __date ) +1, 1 )  
VAR __forecastDate3 =
    DATE( YEAR( __date ), MONTH( __date ) +2, 1 ) 
VAR __baseTbl = ADDCOLUMNS( __tbl, "Forecast Date", __forecastDate1 )
VAR __forecastDateTbl = { __forecastDate2, __forecastDate3 }
VAR __filterTbl = 
    FILTER( __tbl, 'Table'[Difference] > 2000 )   ----------use 'Table'[Difference] instead of 'Table'[Acc Total]
RETURN 
    UNION(
        __baseTbl,
        CROSSJOIN( __filterTbl, __forecastDateTbl )
    )

 

Please let us know if this works.

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Icey
Community Support
Community Support

Hi @kkalyanrr ,

 

Modify @Mariusz 's expression like so:

Table 2 = 
VAR __tbl = 'Table'
VAR __date = TODAY()
VAR __forecastDate1 =
    DATE( YEAR( __date ), MONTH( __date ), 1 )  
VAR __forecastDate2 =
    DATE( YEAR( __date ), MONTH( __date ) +1, 1 )  
VAR __forecastDate3 =
    DATE( YEAR( __date ), MONTH( __date ) +2, 1 ) 
VAR __baseTbl = ADDCOLUMNS( __tbl, "Forecast Date", __forecastDate1 )
VAR __forecastDateTbl = { __forecastDate2, __forecastDate3 }
VAR __filterTbl = 
    FILTER( __tbl, 'Table'[Difference] > 2000 )   ----------use 'Table'[Difference] instead of 'Table'[Acc Total]
RETURN 
    UNION(
        __baseTbl,
        CROSSJOIN( __filterTbl, __forecastDateTbl )
    )

 

Please let us know if this works.

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Mariusz
Community Champion
Community Champion

Hi @kkalyanrr 

 

Can you paste the sample as a data table rather than a screenshot?

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

@Mariusz  - how can I post excel file here, please suggest.

Hi @kkalyanrr 

 

You can select a table array from excel, copy and paste it here in the body of the message, hope this helps.

A B C
1 2 3

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Thank you @Mariusz  

Job NumberAzzz AmountAcc TotalDifferenceEndDate
439738953.79790.98162.8922-05-2020
4401219662.891058.218604.6930-06-2020
4399725160.082085.423074.6815-06-2020
440016525.371253.45271.9719-06-2020
4398638519.941727.7836792.1604-06-2020
4398011502.8469810804.8429-05-2020
4400114210.549813712.5019-06-2020
4399721147.631807.7919339.8415-06-2020
439886016.161626.624389.5406-06-2020
440015200.661654.753545.9119-06-2020
4395918703.781336.5517367.2308-05-2020
4398013161.951354.1511807.8029-05-2020
4398730213.98892.129321.8805-06-2020
4399413672.261242.712429.5612-06-2020
439806112.23854.155258.0829-05-2020
4400135420.63894.7434525.8919-06-2020
4401515035.171208.5113826.6603-07-2020
4400821378.43942.720435.7326-06-2020
440013008.081982810.0819-06-2020
4398011993.061466.6510526.4129-05-2020
4400810412.51741.959670.5626-06-2020
439957428.5807428.5813-06-2020
439949244.1611988046.1612-06-2020
4401121136.4249820638.4229-06-2020
4400121657.260021057.2019-06-2020
4399213848.2430013548.2410-06-2020
4400822573.7180021773.7126-06-2020
4400123556.71961.822594.9119-06-2020
439949430.7554.958875.7512-06-2020
4390343202.7943202.790.0013-03-2020
43967202705.57202500.38205.1916-05-2020

HI @kkalyanrr 

 

You can create a table like below, or see the attached for reference.

Table 2 = 
VAR __tbl = 'Table'
VAR __date = TODAY()
VAR __forecastDate1 =
    DATE( YEAR( __date ), MONTH( __date ), 1 )  
VAR __forecastDate2 =
    DATE( YEAR( __date ), MONTH( __date ) +1, 1 )  
VAR __forecastDate3 =
    DATE( YEAR( __date ), MONTH( __date ) +2, 1 ) 
VAR __baseTbl = ADDCOLUMNS( __tbl, "Forecast Date", __forecastDate1 )
VAR __forecastDateTbl = { __forecastDate2, __forecastDate3 }
VAR __filterTbl = 
    FILTER( __tbl, 'Table'[Acc Total] > 2000 )
RETURN 
    UNION(
        __baseTbl,
        CROSSJOIN( __filterTbl, __forecastDateTbl )
    )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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