Forum Discussion
lacq
8 years agoRegular Visitor
DAX: Rollup value within a group
Hi Community, I've one question, maybe a silly one, but I already wasted some time trying to solve the following requirement... I've the following very simple star schema model in my PBI file...
- 8 years ago
Hi lacq
First add a calculated column in your FactValues
Use this Column in the Visual
CountryName = related(DimCountry[CountryName])
Now you can use this MEASURE to get the Cumulative
Cumulative = CALCULATE ( SUM ( FactValues[Value] ), FILTER ( ALLEXCEPT ( FactValues, FactValues[CountryName] ), FactValues[Date] <= SELECTEDVALUE ( FactValues[Date] ) ) )
Zubair_Muhammad
Community Champion
8 years ago
In that case, I believe you will just need to extend the
ALLEXCEPT ( FactValues, FactValues[CountryName] )
to
ALLEXCEPT ( FactValues, FactValues[CountryName], FactValues[ProductName] )
nickchobotar
Skilled Sharer
8 years agoHello lacq
Just poking in with slightly different approach which does not require bringing in the country name string into the fact table via RELATED()
= CALCULATE (
SUM ( FactValues[Value] ),
FILTER (
ALL ( FactValues ),
FactValues[Date] <= MAX ( FactValues[Date] )
&& FactValues[CountryKey] IN VALUES ( DimCountry[CountryKey] )
)
)
Zubair_Muhammad Really liked your SELECTEDVALUE() over the dates
Thank, Nick -