Power BI getting 2 week back same day value

0 votes

So, I'm attempting to create a measure in Power BI which shall provide to me, the value of sales amount for past two weeks till the current day.

e.g Today = Tuesday 27-Sep-2016 so I need value for Tuesday 13-Sep-2016

Table Format:

 Date       |  SalesAmount
-----------------------------
01-Sep-2016 | 500
02-Sep-2016 | 450
03-Sep-2016 | 650
Apr 5 in Power BI by Shubham
• 12,270 points
8 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can use DATEADD() function to compute the 14 days before each date. Create a measure using the below code.

SalesTwoWeeksAgo =
CALCULATE (
    SUM ( 'Table'[SalesAmount] ),
    FILTER (
        ALL ( 'Table' ),
        COUNTROWS (
            FILTER (
                'Table',
                EARLIER ( 'Table'[Date] ) = DATEADD ( 'Table'[Date], -14, DAY )
            )
        )
    )
)

While the previous DAX expression works, I'd reckon you create a calculated column which is better than the measure-approach when it comes down to performance.

answered Apr 5 by Upasana
• 7,680 points

Related Questions In Power BI

0 votes
1 answer

Are 2 MM rows too much data for Power BI Online to manage?

PowerBI can easily handle 400MM rows and ...READ MORE

answered Sep 28, 2018 in Power BI by Kalgi
• 35,880 points
20 views
0 votes
1 answer

getting client-credentials access token to authorize Power BI

Try and make sure that the app ...READ MORE

answered Oct 17, 2018 in Power BI by Annie97
• 2,190 points
873 views
0 votes
1 answer

Unable to install connector for Power Bi and PostgreSQL

I think the problem is not at ...READ MORE

answered Aug 21, 2018 in Power BI by nirvana
• 3,040 points
351 views
+2 votes
2 answers

Migrate power bi collection to power bi embedded

I agree with Kalgi, this method is ...READ MORE

answered Oct 11, 2018 in Power BI by Hannah
• 14,080 points
58 views
0 votes
1 answer

Power BI DAX expression more than 2 or conditon

Heyyy @Hannah, you just need remove or ([principlecode] = ...READ MORE

answered Oct 29, 2018 in Power BI by Kalgi
• 35,880 points
79 views
+3 votes
2 answers

Combine tables in Power BI

You can also achieve this using a ...READ MORE

answered Oct 5, 2018 in Power BI by lina
• 8,100 points

edited Oct 11, 2018 by Kalgi 85 views
0 votes
1 answer

Power Bi Dax Table

You need to wrap the numbers in ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 35,880 points
42 views
0 votes
2 answers

Power BI Dax Multiple IF AND Statements

HI I have Column Patient 12 13 14 15 18 IN Patient=12, 13 Out ...READ MORE

answered 4 days ago in Power BI by VNK
3,737 views
0 votes
1 answer

How can i see my plugin name in the Power BI Visual plugin List ?

there is a couple of errors in your ...READ MORE

answered Nov 8, 2018 in Power BI by Upasana
• 7,680 points
31 views
0 votes
1 answer

Error:connecting to Azure SSAS server in Power-BI through Import mode

If I understand correctly, you're connecting to ...READ MORE

answered Nov 9, 2018 in Power BI by Upasana
• 7,680 points
121 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.