Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Dear All,
I would like to sum the rows for val if they are last day of the month and if they are in the weekdays. If last day of the month corresponds to either saturday or sunday then sum friday. What could be the formula? I need e general formula to add. I have several months in my table.
Thank you.
Solved! Go to Solution.
Hi @memasarif ,
Would you please refer to the measure below:
Measure =
VAR a =
ADDCOLUMNS (
SUMMARIZE (
'Table',
'Table'[Date],
'Table'[Val],
"weekday", WEEKDAY ( 'Table'[Date], 2 ),
"weeknum", WEEKNUM ( 'Table'[Date] ),
"eomonth", EOMONTH ( 'Table'[Date], 0 )
),
"lastworkday",
IF (
'Table'[Date] = [eomonth],
IF ( [weekday] <= 5, 1, 0 ),
IF ( [weekday] = 5 && [weeknum] = WEEKNUM ( [eomonth] ), 1, 0 )
)
)
RETURN
SUMX ( FILTER ( a, [lastworkday] = 1 ), 'Table'[Val] )
For more details, please refer to the pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/ER3TmlaekNFKjActYx...
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi @memasarif ,
Would you please refer to the measure below:
Measure =
VAR a =
ADDCOLUMNS (
SUMMARIZE (
'Table',
'Table'[Date],
'Table'[Val],
"weekday", WEEKDAY ( 'Table'[Date], 2 ),
"weeknum", WEEKNUM ( 'Table'[Date] ),
"eomonth", EOMONTH ( 'Table'[Date], 0 )
),
"lastworkday",
IF (
'Table'[Date] = [eomonth],
IF ( [weekday] <= 5, 1, 0 ),
IF ( [weekday] = 5 && [weeknum] = WEEKNUM ( [eomonth] ), 1, 0 )
)
)
RETURN
SUMX ( FILTER ( a, [lastworkday] = 1 ), 'Table'[Val] )
For more details, please refer to the pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/ER3TmlaekNFKjActYx...
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
@memasarif - Thinking something like:
Measure =
VAR __Date = MAX([DATE])
VAR __Table = 'Table'
VAR __Table1
ADDCOLUMNS(
__Table,
"FinalVal",
SWITCH([DAY NAME]),
"SUNDAY",SUMX(FILTER(__Table,[DATE]=__Date-2),[VAL]),
"SATURDAY",SUMX(FILTER(__Table,[DATE]=__Date-1),[VAL]),
[VAL]
)
)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.