Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi Experts,
I currently have a dax function
Solved! Go to Solution.
On top this
Margin % Today = CALCULATE(SUM(dailyKPI[Margin %]),'Date'[Date] = TODAY() -1)
Create a new measure
averageX(values(dailyKPI[Warehouse]) , [Margin % Today])
@Nanakwame I agree with @amitchandak on how to get the average calculation. See my post here if you want to understand more why: https://excelwithallison.blogspot.com/2020/09/what-does-average-mean.html
As for ignoring weekends, you can do this easily if you have a dimDate table that has a column that flags weekends or at very least a weekday column.
https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html
It looks like you have a date table, so just depends on how you create the weekday column.
Assuming a 'Date'[Weekday] column that flags weekday as 1 and weekends as 0, the new measure would look something like:
Margin % Today =
VAR _Today = TODAY()
VAR _Yesterday = MAXX( FILTER( 'Date', 'Date'[Date] < _Today && 'Date'[Weekday] = 1 ), 'Date'[Date] )
RETURN
CALCULATE(SUM(dailyKPI[Margin %]),'Date'[Date] = _Yesterday)
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@Nanakwame I agree with @amitchandak on how to get the average calculation. See my post here if you want to understand more why: https://excelwithallison.blogspot.com/2020/09/what-does-average-mean.html
As for ignoring weekends, you can do this easily if you have a dimDate table that has a column that flags weekends or at very least a weekday column.
https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html
It looks like you have a date table, so just depends on how you create the weekday column.
Assuming a 'Date'[Weekday] column that flags weekday as 1 and weekends as 0, the new measure would look something like:
Margin % Today =
VAR _Today = TODAY()
VAR _Yesterday = MAXX( FILTER( 'Date', 'Date'[Date] < _Today && 'Date'[Weekday] = 1 ), 'Date'[Date] )
RETURN
CALCULATE(SUM(dailyKPI[Margin %]),'Date'[Date] = _Yesterday)
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
On top this
Margin % Today = CALCULATE(SUM(dailyKPI[Margin %]),'Date'[Date] = TODAY() -1)
Create a new measure
averageX(values(dailyKPI[Warehouse]) , [Margin % Today])
User | Count |
---|---|
97 | |
87 | |
78 | |
74 | |
70 |
User | Count |
---|---|
113 | |
105 | |
84 | |
65 | |
64 |