Forum Discussion
Thulasiraman
Helper II
3 years agoSummarize error
Hi I have created a SUMMARIZE Dax which shows the error which I could not understand. Pls help Thulasiraman
FreemanZ
Super User
3 years agohi Thulasiraman
SUMMARIZE returns a table, and, in most cases, a table can't be used as a scalar value directly. So comes the warning.
You need either make some calculation based on that table or use the code to create a new table.
Thulasiraman
Helper II
3 years ago- FreemanZ3 years ago
Super User
hi Thulasiraman Yes, as you see in MahyarTF 's code, SUMMARIZE is every commonly used to build intermediate virtual tables for furthe calculation, like TOPN, ADDCOLUMNS, FILTER. Any function taking table expression as argument is good to nest upon SUMMARIZE.
- Thulasiraman3 years ago
Helper II
- Thulasiraman3 years ago
Helper II
In continuation of above, after referring some material I have created the following for TopN which is working fine:
Top3 DC =VAr ranking = VALUES('Itemwise DC All'[Dye Item])ReturnCALCULATE([Total cost], TOPN( 3, ALL('Itemwise DC All'[Dye Item]), [Total cost]), ranking)There is no creation of virtual table through SUMMARIZE but the above dax gives correct result so far for 3 of my tables which I tried.I request you to kindly validate the above dax if it is correct and applicable in all conditions.Once again thanking you very much for your patient help.