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, 2019 in Power BI by Shubham
• 13,490 points
1,043 views

1 answer to this question.

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, 2019 by Upasana
• 8,620 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
• 52,360 points
853 views
+1 vote
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,160 points
4,577 views
0 votes
1 answer

How to open hyperlink in the same tab in power BI

Hey, the discussion on this topic is ...READ MORE

answered Jul 10, 2019 in Power BI by anonymous
• 33,030 points
10,307 views
+1 vote
1 answer

I HAVE 2 REQUIREMENT PLEASE HELP IN POWER BI

you have a table with data time ...READ MORE

answered Dec 3, 2019 in Power BI by Priyanka
1,746 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
• 52,360 points
2,657 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,220 points

edited Oct 11, 2018 by Kalgi 2,097 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
• 52,360 points
929 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 May 23, 2019 in Power BI by VNK
18,423 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
• 8,620 points
1,082 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
• 8,620 points
2,396 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP