Forum Discussion

AmandaHore's avatar
AmandaHore
Icon for Helper I rankHelper I
2 years ago

Greater than a calculated value

I am fairly new to power bi and working on creating a report for our teams timesheets. 

 

 

In this table the Total Timesheet column is a combination of the other 3 columns.  

I want to create a value in eeh TimeinLue column if the value is greater than 5 return True.  (I will evenutally change this to be 76 being the hours worked but I cannot get it to work so thought I would do a lesser value to try and work out where the isuse is.  

My measure is: 

TimeinLue = if(selectedvalue('BI FactUserTimesheet'[TotalTimesheet]) >= 5,"True","False")

All of the values should be true in this example, but some with a value of 76.55 are showing as false.  

What I am doing wrong with my measure?

11 Replies

  • sumanth_v's avatar
    sumanth_v
    Regular Visitor

    Let me get this straight. For each row,When a value in Total Timesheet >5, Then TimeinLue should be True ?

    Isn't it.

    • sumanth_v's avatar
      sumanth_v
      Regular Visitor

      If that is the case then, your measure should be - 

      TimeinLue = IF(SELECTEDVALUE(Sheet1[Total Timesheet])>=5,TRUE,False)
       
      Mark it as solution, If it works for you😉
      • AmandaHore's avatar
        AmandaHore
        Icon for Helper I rankHelper I

        That is what I am using.  it works fine for the first two rows, but the third row that has a value of 76.55 it shows as false and I am not sure why

         

    • AmandaHore's avatar
      AmandaHore
      Icon for Helper I rankHelper I

      Yes that is what I want. 

      This is my measure and it is not working

      TimeinLue = if(selectedvalue('BI FactUserTimesheet'[TotalTimesheet]) >= 5,True,FALSE)
      The first two rows show true, but the third for that has a value of 76.55 shows false 
  • The issue is likely in the selectedvalue('BI FactUserTimesheet'[TotalTimesheet]) part of your measure.

    SELECTEDVALUE() will return a blank, if there is more than 1 possible value. And since blank < 5, it returns false. To fix it - you can try change the SELECTEDVALUE() to whatever aggregation you have on the field (i.e if it's SUM, AVERAGE, etc...).

    Otherwise, you'll need to post some sample data (please remove or censor any sensitive information), as it's not really possible to debug with the data in the screenshot.

  • sumanth_v's avatar
    sumanth_v
    Regular Visitor

    Do you mind, attaching you power bi file if there is no sensitive data?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, AmandaHore 

    Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

     

    Best Regards

    Yongkang Hua