Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
I'd really appreciate you can help me. I have a table like this one:
Basically, it's showing the number of cases by day and country. The list has many rows. I need to add a column that shows the difference between the number of cases of that day and the number of cases 14 days before. I'm not familiar with DAX, and I know neither how to refer to the specific value of a cell in a column nor how to specify the number of rows behind to look for the difference's value.
I really appreciate any help you can provide.
Best
Pedro
Solved! Go to Solution.
Hi,
You can use LookupValue function:
Country_Date - 14 days =
LOOKUPVALUE (
Covid[New_Cases],
Covid[Country], Covid[Country],
Covid[Date], DATEADD ( Covid[Date], -14, DAY )
)
This is result:
Firstly it searches for same country and then for date and date - 14 days.
Regards,
Nemanja Andic
Thank you Nandic, your code helped me to create a column with the number of cases as of 14 days before; I just created another column with the subtraction to get the difference in the number of cases.
Thanks a lot,
Pedro
Hi,
You can use LookupValue function:
Country_Date - 14 days =
LOOKUPVALUE (
Covid[New_Cases],
Covid[Country], Covid[Country],
Covid[Date], DATEADD ( Covid[Date], -14, DAY )
)
This is result:
Firstly it searches for same country and then for date and date - 14 days.
Regards,
Nemanja Andic
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
10 |
User | Count |
---|---|
19 | |
16 | |
14 | |
11 | |
9 |