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.
I have this table, and $/LBS is a measure that I created simply by dividing $ and LBS column.
I want to see the following two columns in the table view next to the $/LBS column
Pecent Change (Previous Month) was calculated by =(Month-Prev Month) / Prev Month
Pecent Change (Compared to Jan) was calculated by= (Month - $Jan) / $Jan
If anyone could show me how to do this in PowerBi, I would appreciate it!
Solved! Go to Solution.
Hi, @Anonymous
Please try the following methods.
Sample Data:
$/LBS = DIVIDE(SELECTEDVALUE('Table'[$]),SELECTEDVALUE('Table'[LBS]))
Prev Month =
VAR PrevDate=MAXX(FILTER(ALL('Table'[Date]),[Date]<SELECTEDVALUE('Table'[Date])),[Date])
Var PrevMonth=CALCULATE([$/LBS],FILTER(ALL('Table'),[Date]=PrevDate))
Return
PrevMonth
Pecent Change (Previous Month) = DIVIDE([$/LBS]-[Prev Month],[Prev Month])
Pecent Change (Compared to Jan) =
Var Jan=CALCULATE([$/LBS],FILTER(ALL('Table'),MONTH([Date])=1))
return
DIVIDE([$/LBS]-Jan,Jan)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Please try the following methods.
Sample Data:
$/LBS = DIVIDE(SELECTEDVALUE('Table'[$]),SELECTEDVALUE('Table'[LBS]))
Prev Month =
VAR PrevDate=MAXX(FILTER(ALL('Table'[Date]),[Date]<SELECTEDVALUE('Table'[Date])),[Date])
Var PrevMonth=CALCULATE([$/LBS],FILTER(ALL('Table'),[Date]=PrevDate))
Return
PrevMonth
Pecent Change (Previous Month) = DIVIDE([$/LBS]-[Prev Month],[Prev Month])
Pecent Change (Compared to Jan) =
Var Jan=CALCULATE([$/LBS],FILTER(ALL('Table'),MONTH([Date])=1))
return
DIVIDE([$/LBS]-Jan,Jan)
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , You can use time intelligence to get it , if you have date table
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
Or have month year table with month rank
Month Rank = RANKX(all('Date'),'Date'[Month Start date],,ASC,Dense)
This Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])))
Last Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])-1))
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
"Sum" also works for a column in a data table. $/LBS is a measure that you see in a table visualization. So I can't use the Sum function to do this, unfortunatley.
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 |
---|---|
116 | |
102 | |
78 | |
77 | |
49 |
User | Count |
---|---|
145 | |
108 | |
107 | |
89 | |
61 |