Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

get a sort value for unlinked records

Hi 

I'm new to Power Bi so sorry inadvance for the possible stupid questions.

I have a database loaded into te model with incidents and a priority level. 
in different tables linked on the priorityid.

When i count the incidents i get somethin like this (fictional numbers)

 

P1  70

P2 400

P3 1000

P4 3000

 400

So the last 400 incidents didn't get a Piriority id does count them as expected.
now i added a value to the priority to sort them (1 - 4) so i can put them in order (the text values contain more data then the P-number)

but the 400 without priority dont get an number.
So i want to mak a column where i put the ordernumber when it exists and the biggest ordernumber +1 when it doesn't exist.
but i can't get it right.

I tried:

PrioritySort = IF ( ISBLANK(Incidents[priorityId]) , max(IncidentPriorities[IncidentPriorityOrder]) +1 , IncidentPriorities[IncidentPriorityOrder])
 
I get a error message that my false clause isn't single value.

how can i solve this?


 

  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi,

     

    Thanks for the answers, they didn't really did the trick but they set me on the path to the solution.


    This works:

    PrioritySort = IF (
    ISBLANK ( Incidents[priorityId] ) ,
    MAX ( IncidentPriorities[IncidentPriorityOrder] ) + 1 ,
    RELATED(IncidentPriorities[IncidentPriorityOrder] )
    )

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi ,

      Here some sample date:

       

       

       

       

       

       

       

      The first row i want to put 5 in a new column and the other rows shou state the incidentPriorityOrder
      so i can sort 1- 5

       

      regards

       

      Christoph

  • v-yuta-msft's avatar
    v-yuta-msft
    Icon for Community Support rankCommunity Support

    Anonymous ,

     

    You may change measure to calculate column:

     

    Spoiler
    PrioritySort =
    IF (
    ISBLANK ( Incidents[priorityId] ),
    MAX ( IncidentPriorities[IncidentPriorityOrder] ) + 1,
    IncidentPriorities[IncidentPriorityOrder]
    )

    Community Support Team _ Jimmy Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      Thanks for the answers, they didn't really did the trick but they set me on the path to the solution.


      This works:

      PrioritySort = IF (
      ISBLANK ( Incidents[priorityId] ) ,
      MAX ( IncidentPriorities[IncidentPriorityOrder] ) + 1 ,
      RELATED(IncidentPriorities[IncidentPriorityOrder] )
      )