Forum Discussion

Analitika's avatar
Analitika
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

Gone measure results after Matrix value selected

 

Data model

Data model

 

SalesAmountWithTotal = VAR _CurrentAxis = SELECTEDVALUE('DimChannelTotal'[ChannelName]) RETURN IF(_CurrentAxis = "Total"; IF(SELECTEDVALUE(YesNo[Values];1) = "Yes"; SUM(FactSales[SalesAmount]); BLANK() ); CALCULATE( SUM(FactSales[SalesAmount]); DimChannel[ChannelName] = _CurrentAxis ) )

 

 

And Matrix

DimChannel[ChannelName] | DimChannel[ChannelLabel] | FactSales[DataKey]

 

Problem is that ChannelName working good only if i press in matrix on DimChannel[ChannelName], if in matrix i press on column value only Total left and i cant see ChannelName anymore. So how to show always ChannelName not matter which column value selected?

 

 

and why if i put in separate measure _CurrentAxis = SELECTEDVALUE('DimChannelTotal'[ChannelName])

it always showing empty values but working in SalesAmountWithTotal measure?

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Analitika ,

    As checked your post description, the line chart using the field DimChannel[ChannelName] not the field 'DimChannelTotal'[ChannelName], so please update the formula of your measure [SalesAmountWithTotal] as below and check whether you can get the correct result:

    SalesAmountWithTotal =
    VAR _CurrentAxis = DimChannel[ChannelName]
    RETURN
        IF (
            _CurrentAxis = "Total",
            IF (
                SELECTEDVALUE ( YesNo[Values], 1 ) = "Yes",
                SUM ( FactSales[SalesAmount] ),
                BLANK ()
            ),
            CALCULATE (
                SUM ( FactSales[SalesAmount] ),
                DimChannel[ChannelName] = _CurrentAxis
            )
        )

    Best Regards

    • Analitika's avatar
      Analitika
      Icon for Post Prodigy rankPost Prodigy

      Nope. this is not working, as DimChannel[ChannelName]  never = "Total"

      As Total is custom created field, so if i do like your example i loosing Total line in chart

       

      DimChannelTotal =

      FILTER (
      DISTINCT (
      UNION (
      DISTINCT ( DimChannel[ChannelName] ),
      ROW ( "Selected", "Selected" ),
      ROW ( "Total", "Total" )
      )
      ),
      NOT ISBLANK ( [ChannelName] )
      )