Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Date doesn't filter

I have one measure that filters the data correctly by date: 

Plant_Daily_AVG = CALCULATE(AVERAGE('Raw Data'[VALUE]),'Raw Data'[ORIGIN_CODE]="R",'Date'[Date])
(I linked the raw data [date] (which has results for the same day therefore there are mulitple dates) with the Date Calendar I made which has one date.)
I get results per day when I use the slicer. 
 I then want to list it in an if statement so I can pull by IPN number.
Result =  IF(Report2[IPN]=RELATED('Treatment Plant'[IPN]),CALCULATE('Treatment Plant'[Plant_Daily_AVG]),0)
I lose the date slicer ability and i just takes the average of all data.
How do I get the date back?
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    Since your result column is a calculated column, calculated columns can't dynamically change values, so he won't change based on slicer changes. You can create a measure instead.

    Result = 
    var _a=LOOKUPVALUE('Treatment Plant'[IPN],Report2[id],MAX('Treatment Plant'[id]))
    return IF(MAX('Report2'[IPN])=_a,[Plant_Daily_AVG],0)

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Since your result column is a calculated column, calculated columns can't dynamically change values, so he won't change based on slicer changes. You can create a measure instead.

    Result = 
    var _a=LOOKUPVALUE('Treatment Plant'[IPN],Report2[id],MAX('Treatment Plant'[id]))
    return IF(MAX('Report2'[IPN])=_a,[Plant_Daily_AVG],0)

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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