Forum Discussion

FaisalImam's avatar
FaisalImam
Helper I
4 years ago
Solved

Model Relationship

Hi All,

 

Basically I am unable to create relation between two tables.There is one table with Static data :Type,key service level(consider as formula names). Another table with raw data but both these table have nothing in common.Now we need to calculate some measures and store it in respective  keyservicxe level.

 

When I try to store it in respective row, because I dnt have relation,all row gets filled by the same value.

 

Model table :

 

KeyService levelMarch month
A1resolution -a156
B3resolutioncritical-a275

 

 

Can we compare the row values(a1,a2) with the measures name ? In that way we can store it in specific rows as required.

  • PaulDBrown's avatar
    PaulDBrown
    4 years ago

    SWITCH is a function used in measures /calculated columns wich is essentially  nested IFs executed in order. So the measure in this case is checking the filter context (established by SELECTEDVALUE) and returning the corresponding measure. So the first statement checks whether the conext is "A1" and if true returns the measure [M1] and so on...Make sense?

7 Replies

  • FaisalImam , Not very clear

     

    measure like

    a1 = calculate(sum(Table[March Month]) , Filter(all(Table[Level]) Table[level] ="a1") )

     

     

    a2 = calculate(sum(Table[March Month]) , Filter(all(Table[Level]) Table[level] ="a2") )

    • FaisalImam's avatar
      FaisalImam
      Helper I

      No Actually you did not get my point.

       

      The table , I have shown is how it will be coming on the dashboard.

      Column1- Key Service Level  ( has all static values in table1 )

      Column 2 - Month( has values calculated from another table - table 2  in which everymonth data will be refreshed) 

       

      My problem : I am unable to put the values that I have calculated in the right row because we don't have any relation..

      Example  :

      Table 1

      Key Service Expected
      A195%
      A1.165%
      A290%

       

      Table 2 :

      inctime period
      sghdf74
      srwetbnjl91
      sdgyfumbm42

       

      Now from table 2 ,I have calculated several measures  let it be M1,M2,M6

       

      Now how it needs to be viewd on dashboard:

       

      key service levelexpectedMeasures
      A195%M1
      A1.165%M6
      A290%M2

       

      What logic to use top have such relation. We don't have any relation between measures and the key service level.

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Try

    TheMeasures = 

    SWITCH(SELECTEDVALUE (Table1[Key Service]),
    "A1", [M1],
    "A1.1", [M6],
    "A2", [M2])

    • FaisalImam's avatar
      FaisalImam
      Helper I

      Can you explain brief please ? I am a begginer.

      Do you mean to create a new column using the above switch statement ? if so in which table ? The one having static data or the one where we have calculated the measures.

      • PaulDBrown's avatar
        PaulDBrown
        Community Champion

        You need to create a new measure with the code. Then create a new table visual, add the fields from Table 1 and add the measure

    • FaisalImam's avatar
      FaisalImam
      Helper I

      Hi PaulDBrown,

       

      Thanks , this actually somewhat worked. Can you please explain what the  qwuery is actually doing  as that would be helpful for me to learn.

      • PaulDBrown's avatar
        PaulDBrown
        Community Champion

        SWITCH is a function used in measures /calculated columns wich is essentially  nested IFs executed in order. So the measure in this case is checking the filter context (established by SELECTEDVALUE) and returning the corresponding measure. So the first statement checks whether the conext is "A1" and if true returns the measure [M1] and so on...Make sense?