Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Measure Does Not Return Result Sometimes

Hi all,

 

Using Power BI Desktop July, 2021.

 

My measure does not return a result in some cases, but other times it returns the expected result. In the measure below, I can see that both dates exist in the referenced tables

Days Elapsed= DATEDIFF(SELECTEDVALUE(Table1[Start Date]),SELECTEDVALUE(Table2[CRDate]),DAY)
 
Thanks,
-w
  • SELECTEDVALUE will return the value if there is only one distinct selected value in the column.

    Most likely your measure is not working when you have more than one value or when there is no corresponding date in Table1 or Table2 in your filter context.

4 Replies

  • Anonymous 

    could you pls provide the sample data and expected output?

     

  • Mohammad_Refaei's avatar
    Mohammad_Refaei
    Solution Specialist

    SELECTEDVALUE will return the value if there is only one distinct selected value in the column.

    Most likely your measure is not working when you have more than one value or when there is no corresponding date in Table1 or Table2 in your filter context.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks m_refaei,

      It also seems I cannot use DateDiff as a meausre directly on a date file in a table.
      For example this does not seem to work as a measure, but it does work as a calculated column

      Total Days = DATEDIFF(Dates[Begin_Date],Dated(End_Date],DAY)

      What other function should I wrap each date in to get this work as a Measure?

      Thanks,
      -w


  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    1. Are you select the two tables in the slice values when only a table of selected values, which led to the equation has only one value can not be calculated.

    2. Check that the results in the data view are correct. If you have multiple duplicate rows, when you add the fields to the table visual, they may aggregate and return larger values or not.

     

    Can you share sample data and sample output in table format? Or a sample pbix after removing. sensitive data.

     

    Best Regards,

    Liu Yang

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