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.
Hi,
I have got a table that only contains two column Legend (for Dates) and EOD Volume (for volume) as shown below.
I need to calculate the difference between the previous date volume. For example to calculate the difference between Feb 29 to March 2nd, it will be ((1469-1877) / 1469) * 100%. How to do create this measure in power BI. And the data also contains weekends and weekdays and i will need the analysis for all dates regardless of weekends and/or weekdays. Could someone please help me on this. Thank you in advance. 🙂
Solved! Go to Solution.
@Anonymous Looks like something to do with the hierarchy you are using in your visual. If I select plain date, I can see the prior date number. Is it a must that you have to use a hierarchy type structure ? If so, you can probably use a calculated column that has the month and date separately. Give it a shot.
Hi @karun_r and @amitchandak. I really appriciate the help. However, it seems some of the formula given needs to convert the date column (LEGEND) into measure . I am not sure how to get it it done. I have uploaded the power BI file here (https://drive.google.com/file/d/11WQSnt9WuTZE_gNznSu4zzlFULE6LXz2/view?usp=sharing), It only has two columns. I really appriciate if you can help me out with this one. Been on the same issue since the past few days, cant seem to crack it. 😐 Thank you in advance 🙂
@Anonymous , You can create a day behind measure along with date dimension you can do that
example
sales = SUM(Sales[Sales Amount])
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,day))
Change % = divide(([sales]-[Day behind Sales]),[Day behind Sales])
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 :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
@amitchandak I think with the dataset @Anonymous has, if we just do a DATEADD(,-1,DAY) on the time dimension, it might not work as the user has gaps in the time dimension.
@AnonymousProbably if you can share a sample .pbix file, it would be easier for us to help. From what I can see in your data, something like this should work in your case
EOD Volumes Prior Date := VAR currentDate = 'Date'[Day]
RETURN CALCULATE([EOD Volumes], LASTNONBLANK('Date'[Day], 'Date'[Day] < currentDate)
@karun_r , @Anonymous
True.
We can also use like
Last Day 1 = CALCULATE(sum('order'[Qty]),filter(all('Date'),'Date'[Date] =MAXX(FILTER(all('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
Hi @amitchandak ,
I tried creating a column like you suggested, but it is not giving me the values as desired
Anoter version of @amitchandak 's response. Please feel free to use whatever's work best for you
Prior Day Revenue = VAR currentDate = SELECTEDVALUE(Rev[Date], BLANK())
VAR priorDate = CALCULATE(MAX(Rev[Date]), ALL(Rev[Date]), Rev[Date] < currentDate)
RETURN CALCULATE([Revenue], Rev[Date] = priorDate)
Hi @karun_r ,
I tried the solution you suggested, but I am unable to extract any value for the EOD Volume prior date. 😞
@Anonymous Looks like something to do with the hierarchy you are using in your visual. If I select plain date, I can see the prior date number. Is it a must that you have to use a hierarchy type structure ? If so, you can probably use a calculated column that has the month and date separately. Give it a shot.
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 |
---|---|
106 | |
98 | |
75 | |
63 | |
62 |
User | Count |
---|---|
135 | |
105 | |
104 | |
80 | |
65 |