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.
Hello all,
I have a dataset Valuations consisting of market values per ValDate (I only have one business day per month) and per transaction ID as in the example below.
I need to have in my Power BI dashboard a table which gives me the values of each ID on one selected date (hich I get from a date slicer) and the date corresponding to the previous quarter (for example, in my dataset, the -3m date from 29-01-2021 would be 30-10-2020 and so on).
I tried calculating the second date using a measure which returns the correct date:
However, I am not able to calculate a measure which returns the market value per ID at prevQuarter. I tried the following without success:
Any idea of what I might be doing wrong?
ValDate | ID | Value |
30-12-2020 | 1 | 100 |
30-12-2020 | 2 | 56 |
30-12-2020 | 3 | 789 |
29-01-2021 | 1 | 123 |
29-01-2021 | 2 | 75 |
29-01-2021 | 3 | 1015 |
... |
Solved! Go to Solution.
@NunoSDCoelho , With help from a date table, try a measure like
trailing QTR = CALCULATE(SUM(Table[Value]),dateadd('Date'[Date],-1,QUARTER))
@NunoSDCoelho , With help from a date table, try a measure like
trailing QTR = CALCULATE(SUM(Table[Value]),dateadd('Date'[Date],-1,QUARTER))
Thanks @amitchandak for the suggestion.
However, that does not seem to solve the problem as my dates do not always correspond to the last day of the month.
I created a table with the unique values of my dates and added a new column to test your idea but I do not always get a date for the previous quarter:
PrevQuarter = DATEADD(dates[ValDate],-1,QUARTER)
Val Date PrevQuarter
31-07-2020 30-04-2020
31-08-2020
30-09-2020 30-06-2020
30-10-2020
30-11-2020
30-12-2020 30-09-2020
29-01-2021
@NunoSDCoelho , You have to create a date table with all dates.
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
I was not able to get your solution to work, probably because I am comparing different days within the quarters (eg, the 29 jan date would be compared to 30 nov).
I got what I wanted by creating a new column in my original dataset which gets the last date in the previous quarter (using PREVIOUSQUARTER() ) and then adding a new column which looks up this date in the values column (using LOOKUPVALUE() ). Does not seem to be the most efficient solution but at least it works..
Thanks for the help!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |