Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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])
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.