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.
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]
)
)
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 |
---|---|
110 | |
99 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |