Forum Discussion

andrieskoo's avatar
andrieskoo
Frequent Visitor
4 years ago

Calculate max value with conditions

Hi,
I have a problem with calculating max value witch is in special condition.

Expected result column x

all value between columns -20 till 20 calkulating by measure depending from t (is column in tale) and I want to calculate value in column x wich is a max value in row and must be > than value column and < than value from next column, else is 10

11 Replies

  • daXtreme's avatar
    daXtreme
    Icon for Solution Sage rankSolution Sage

    Hi andrieskoo 

     

    I've had a look at the file... Is this at all a PBI model or just a data dump? All the tables are disconnected in there, which makes me think the author does not yet fully understand the basic dimensional modeling principles Power BI is based on. My kind advice would be to first focus on some PBI theory, then on building a good dimensional model (which is always crucial to producing good correct numbers) and then on starting writing correct measures. As it currently stands, this solution will fall apart sooner than anyone thinks.

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi andrieskoo 

    what are the matrix columns from -20 to 20? Are they values in a column in your data or measures? What are the columns invloved in the rows of your matrix visual? Please provide sample data with the code of your measure(s). 

  • andrieskoo's avatar
    andrieskoo
    Frequent Visitor

    tamerj1 ,
    columns from -20 to 20 is value from another table (not in relationship with table witch have column "Kod"), and it is measure 


    and one of measure wich is related to earch column is

    And I calculate this value (for earch temperature) adding column "Temperatura zewn." to wisualization

     

  • andrieskoo's avatar
    andrieskoo
    Frequent Visitor

    tamerj1 ,
    it could be deleted


    I need only this max value for "Kod" columns, all this temperature (-20 to 20) could be hiden

    pehaps, I must calculate "x_pompy" in measure, witch calculate max value, but I do not know how

  • andrieskoo's avatar
    andrieskoo
    Frequent Visitor

    I calculate, but how calculate all in measure, not adding "Temperatura zewn" colunm to wizualization?



    Because when I remove column "Temperatura zewn" result of measure gone (they are based on this temperature)

     

     

    • tamerj1's avatar
      tamerj1
      Icon for Community Champion rankCommunity Champion

      Hi andrieskoo 
      One option is to have this value in the rows grand total of your original matrix

      You can use a new measure 

      New Measure =
      IF ( HASONEVALUE ( _Budynek[Temperatura zewn] ), [Fist Measure], [2nd Measure] )
  • andrieskoo's avatar
    andrieskoo
    Frequent Visitor

    How to display same result without Temperatura zewn kolumn in visualization?