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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Asamadi
Helper I
Helper I

Dax Formula Sum Offset

I Update

Hello, this is my formula in excel, and i want to do in dax (new column or by measure): =IFERROR(SUM(OFFSET(B7,,,-3,1)),"-")

 

how can i perform fomula in the Indicator coulm in Dax in power bi

 

Excel file link:  https://www.dropbox.com/s/fc0mineray4pd1r/Sumoffset.xlsx?dl=0

 

Untitled.png

1 ACCEPTED SOLUTION

Hi @Asamadi,

 

You can create a calculated column like below:

 

Indicator =
IF (
    [ID] <> MIN ( [ID] ),
    CALCULATE (
        SUM ( 'Table1'[Sales] ),
        FILTER (
            'Table1',
            'Table1'[ID]
                >= EARLIER ( 'Table1'[ID] ) - 2
                && 'Table1'[ID] <= EARLIER ( 'Table1'[ID] )
        )
    ),
    BLANK ()
)

 

q9.PNG

 

Best Regards,
QiuyunYu

Community Support Team _ Qiuyun Yu
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

7 REPLIES 7
v-qiuyu-msft
Community Support
Community Support

Hi @Asamadi,

 

I'm not able to download the Excel file as that site is blocked due to policy. Would you please upload the Excel to OneDrive or Dropbox and share it here again if other two communities' post don't meet your requirement?

 

Best Regards,
QiuyunYu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Asamadi,

 

You can create a calculated column like below:

 

Indicator =
IF (
    [ID] <> MIN ( [ID] ),
    CALCULATE (
        SUM ( 'Table1'[Sales] ),
        FILTER (
            'Table1',
            'Table1'[ID]
                >= EARLIER ( 'Table1'[ID] ) - 2
                && 'Table1'[ID] <= EARLIER ( 'Table1'[ID] )
        )
    ),
    BLANK ()
)

 

q9.PNG

 

Best Regards,
QiuyunYu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot Very Usefull

May i have your linkedin ID?

Greg_Deckler
Super User
Super User

I would think:

 

Measure = IFERROR(SUM([Column]),"-")

?

https://msdn.microsoft.com/en-us/library/ee634765.aspx

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Asamadi

 

It is necessary to calculate the amount regardless of the order of the output of the ID column, that is, if the sort is applied, the amount should change?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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