Forum Discussion

nicolaslemerle's avatar
nicolaslemerle
Regular Visitor
3 years ago
Solved

Filter on the last date result by Workplace

Hi the community 🙂

 

i have a question on a report power bi
We does security audits workplaces


I have a table with information workplace/date and result Audit, if need i have too the list complety workplaces

 

on my power bi i have a map to site and i would display the last result by workplace, i have used the card for display the result

 

i can't found (between M-query or Dax-Query) the solution for that 

 

can you help me ? 

thanks 

  •  

    Yes, I can help you with that.

    To display the last result by workplace in Power BI, you can use the following DAX formula:

     

     
    Last Result = VAR MaxDate = MAX('Table'[Date]) RETURN CALCULATE(MAX('Table'[Result]), FILTER('Table', 'Table'[Date] = MaxDate))
     

    Replace 'Table' with the name of your table and 'Date' and 'Result' with the names of your columns for date and result, respectively. This formula will calculate the maximum date for each workplace and then return the result for that date.

    You can then use this DAX formula in a table or visual to display the last result by workplace. For example, you can create a table with the workplace name and the last result using the above formula.

2 Replies

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

     

    Yes, I can help you with that.

    To display the last result by workplace in Power BI, you can use the following DAX formula:

     

     
    Last Result = VAR MaxDate = MAX('Table'[Date]) RETURN CALCULATE(MAX('Table'[Result]), FILTER('Table', 'Table'[Date] = MaxDate))
     

    Replace 'Table' with the name of your table and 'Date' and 'Result' with the names of your columns for date and result, respectively. This formula will calculate the maximum date for each workplace and then return the result for that date.

    You can then use this DAX formula in a table or visual to display the last result by workplace. For example, you can create a table with the workplace name and the last result using the above formula.

    • nicolaslemerle's avatar
      nicolaslemerle
      Regular Visitor

      Thanks for your speedy answer.

      I tried, it work so thank for that too 🙂