Forum Discussion

OcularPatDown's avatar
OcularPatDown
Frequent Visitor
5 years ago
Solved

SSAS Live Connection Measure breaking relationship

When creating a measure when live connected to an SSAS tabular model, simple measures are breaking relationships and causing fields to perform an outer join.

 

I.E. I want to use a switch function so that when region is 'x', the measure returns 1, 'y' 2, 'z' 3

Initial table

Sales OrderRegionSales
1000x20
2000y30
3000z40

 

 

Output:

Sales OrderRegion Measure
1000x201
1000y 2
1000z 3
2000x 1
2000y302
2000z 3
3000x 1
3000y 2
3000z403



Does anyone know why this is happening?

  • Anonymous's avatar
    Anonymous
    5 years ago

    HI OcularPatDown,

    I think you need to add one more condition to prevent the formula calculate on not matched records:

    Measure=
    IF (
        MAX ( Table[Sales] ) <> blank,
        SWITCH ( SELECTEDVALUE ( Region[Region] ), "x", 1, "y", 2, "z", 3 )
    )
    

    Regards.
    Xiaoxin Sheng

4 Replies

    • OcularPatDown's avatar
      OcularPatDown
      Frequent Visitor

      For this example, I used

      test =
      SWITCH (
      TRUE (),
      FIRSTNONBLANK ( Region[Region], TRUE () ) = "x", 1,
      FIRSTNONBLANK ( Region[Region], TRUE () ) = "y", 2,
      FIRSTNONBLANK ( Region[Region], TRUE () ) = "z", 3
      )

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI OcularPatDown,

        I think you need to add one more condition to prevent the formula calculate on not matched records:

        Measure=
        IF (
            MAX ( Table[Sales] ) <> blank,
            SWITCH ( SELECTEDVALUE ( Region[Region] ), "x", 1, "y", 2, "z", 3 )
        )
        

        Regards.
        Xiaoxin Sheng