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
sam_hoccane
Helper I
Helper I

adding new rows in table with condition

Hello Community, 

I am new user to Power BI. Can you please help me with following problem:

I have following table where three rows needs to added.  So after May 22, I would like to add three more lines: June 22, July 22 and August 22 taking the previous month's values and multiplying by 1.2... 

So that means, for 22-June I will take previous month value (i.e. 90 for May) and multiple it by 1.2 and July I will take value of June and multiply it by 1.2.

It would be great if you provide solution in DAX  but power querry also work for me... 

Expected results should look like this :

Year Month 

Value

22-Mar

60

22-Apr

80

22-May

90

22-Jun

108

22-Jul

129.6

22-Aug

155.52

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @sam_hoccane ,

According to your description, I create a sample.

vkalyjmsft_0-1655261914659.png

Here's my solution.

1.Create a new table. Make relationship with the two tables, the Year Month column in the two tables both should be of date type.

vkalyjmsft_1-1655261998176.png

vkalyjmsft_2-1655262031974.png

2.Create a measure.

Measure Value =
IF (
    MAX ( 'Table'[Value] ) <> BLANK (),
    MAX ( 'Table'[Value] ),
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Year Month ] = MAXX ( ALL ( 'Table' ), 'Table'[Year Month ] )
        ),
        'Table'[Value]
    )
        * POWER (
            1.2,
            DATEDIFF (
                MAXX ( ALL ( 'Table' ), 'Table'[Year Month ] ),
                MAX ( 'Table (2)'[Year Month] ),
                MONTH
            )
        )
)

Get the result.

vkalyjmsft_3-1655262184212.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @sam_hoccane ,

According to your description, I create a sample.

vkalyjmsft_0-1655261914659.png

Here's my solution.

1.Create a new table. Make relationship with the two tables, the Year Month column in the two tables both should be of date type.

vkalyjmsft_1-1655261998176.png

vkalyjmsft_2-1655262031974.png

2.Create a measure.

Measure Value =
IF (
    MAX ( 'Table'[Value] ) <> BLANK (),
    MAX ( 'Table'[Value] ),
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Year Month ] = MAXX ( ALL ( 'Table' ), 'Table'[Year Month ] )
        ),
        'Table'[Value]
    )
        * POWER (
            1.2,
            DATEDIFF (
                MAXX ( ALL ( 'Table' ), 'Table'[Year Month ] ),
                MAX ( 'Table (2)'[Year Month] ),
                MONTH
            )
        )
)

Get the result.

vkalyjmsft_3-1655262184212.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to do it in Power Query Editor.

All steps are shown in PQ Editor in the attached file.

Thank you.

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

@Jihwan_Kim thankyou so much for the reply. 

 This is my given data : 

Year Month 

Value

22-Mar

60

22-Apr

80

22-May

90

 

I want to calculate three rows for June, July and August months. So for the june,  I take the Value from May and multiply it with 1.2  (i.e 90 *1.2 = 180) . For july, I take calculated value from  June and multiply it with 1.2 (i.e.  180*1.2= 129.6) and for August I am  taking calculated value from July and multiply it with 1.2 (i.e. 129.6*1.2 ).  Is it possible is  DAX ? if not than Power Querry is fine

 

so final result should look like this :

Year Month 

Value

22-Mar

60

22-Apr

80

22-May

90

22-Jun

108

22-Jul

129.6

22-Aug

155.52

 

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.