Forum Discussion
PowerBITestingG
Resolver I
3 years agoAlternative to allselected to sum rows with same value
Hello,
I am trying to create a measure (Available total) that sums rows if the Country is the same . Any ideas?
| DC | DC Type | Primary Source | Source | Country | Available | Available total |
| IN03 | COUNTRY | US03 | India | 23 | 151.4 | |
| IN04 | COUNTRY | US03 | India | 128.4 | 151.4 | |
| CN03 | COUNTRY | US03 | China | 7 | 4327 | |
| CN05 | COUNTRY | US03 | China | 1440 | 4327 | |
| CN02 | COUNTRY | US03 | US03 | China | 2880 | 4327 |
This the formula that I have but as it uses ALLSELECTED and I need to use it then in an iterator so its giving me values in other measures that dont make sense
Available total =
var AVA_summary =
SUMMARIZE (ALLSELECTED(DCList),
DCList[DC & ProductCd],
DCList[ProductCD&Country],
DCList[Source],
DCList[DC])
return
SUMX(AVA_summary,[Available])
(calculated column wont work because of it requieres user input variables)
2 Replies
- Greg_Deckler
Community Champion
PowerBITestingG Hard to tell exactly what is going on here without more information. But generally I would expect something like this:
Available Total VAR __Country = MAX('DCList'[Country]) VAR __Table = GROUPBY('DCList',[Country],"__Value",SUMX(CURRENTGROUP(),[Available])) VAR __Result = MAXX(FILTER(__Table,[Country] = __Country),[__Value]) RETURN __Result- PowerBITestingG
Resolver I
I get an error. "The calculate function cannot be used in an expression argument for the GROUPBY() function. I should have specified that Available is already a measure summing measures.