Forum Discussion
MichaelG1117
2 years agoHelper I
Creating a Calculated Column when Making a Table
Hi Everyone, I'm making a Date Table and in it I want to include a calculated Column "Total Order Amount" from 'Orders' Table where "Total Order Amount" column equals Orders[OrderQuantity] * Orders...
- 2 years ago
Hi MichaelG1117 ,
Based on your description, Please try code as below to create a Calculated Column.
My Sample:
Table = var _table= ADDCOLUMNS( CALENDAR(DATE(2013,1,1),DATE(2013,1,31)), "Weeknum", WEEKNUM([Date]), "Week Number & Year", "W" & WEEKNUM([Date]) & " " &YEAR([Date]), "WeekYearNumber", YEAR([Date]) & 100 + WEEKNUM([Date]) ) return ADDCOLUMNS( _table, "Total Order Amount", SUMX( FILTER(ALL(Orders), 'Orders'[OrdeDaterKey]=EARLIER([Date])),[OrderQuantity]*[SalesPrice]) )Result is as below.
Best Regards,
Yulia YanIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-weiyan1-msft
2 years agoCommunity Support
Hi MichaelG1117 ,
Based on your description, Please try code as below to create a Calculated Column.
My Sample:
Table =
var _table=
ADDCOLUMNS(
CALENDAR(DATE(2013,1,1),DATE(2013,1,31)),
"Weeknum", WEEKNUM([Date]),
"Week Number & Year", "W" & WEEKNUM([Date]) & " " &YEAR([Date]),
"WeekYearNumber", YEAR([Date]) & 100 + WEEKNUM([Date])
)
return
ADDCOLUMNS(
_table,
"Total Order Amount",
SUMX(
FILTER(ALL(Orders),
'Orders'[OrdeDaterKey]=EARLIER([Date])),[OrderQuantity]*[SalesPrice])
)
Result is as below.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- MichaelG11172 years agoHelper I
Thanks!