Forum Discussion

Robert_G's avatar
Robert_G
Frequent Visitor
2 years ago
Solved

Different Measure values after sort by column in Tableview

After I have sorted a Tablecolumn my Measure is not working correctly anymore:

The measure calc simpl the cloumn-total

 

Having a matrix with one column "LDkurz" (this col is beeing sorted by another one called RegCD).

Before sorting: var summe = calculate(count(Basisdaten[PolNr]),all(Basisdaten[LDKurz])) works as expected

 

After sorting I have to modify to 

var summe = calculate(count(Basisdaten[PolNr]),all(Basisdaten[LDKurz]),all(Basisdaten[RegCD]))
in Order to get the correct values.
 
I am wondering about the behaviour

Version:

2.120.731.0 64-bit (August 2023)

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Robert_G ,

     

    When you sort a column in Power BI, it can affect the filter context and potentially impact the behavior of your measures.

    ALL FunctionThe function removes filters from a column or table, allowing you to create measures that ignore specific filters. In your original measure, you used to remove filters from the “LDkurz” column. However, when you sorted by another column (“RegCD”), the filter context changed, and your measure no longer worked correctly.

    The modified measure will consider all rows in the “Basisdaten” table, regardless of any filters applied to either “LDkurz” or “RegCD.”This approach maintains consistency even after sorting by “RegCD.”

     

    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. 

2 Replies

  • Robert_G , Try like

     

    var summe = calculate(count(Basisdaten[PolNr]),all(Basisdaten[LDKurz],Basisdaten[RegCD]))

     

     

    If this does not help
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Robert_G ,

     

    When you sort a column in Power BI, it can affect the filter context and potentially impact the behavior of your measures.

    ALL FunctionThe function removes filters from a column or table, allowing you to create measures that ignore specific filters. In your original measure, you used to remove filters from the “LDkurz” column. However, when you sorted by another column (“RegCD”), the filter context changed, and your measure no longer worked correctly.

    The modified measure will consider all rows in the “Basisdaten” table, regardless of any filters applied to either “LDkurz” or “RegCD.”This approach maintains consistency even after sorting by “RegCD.”

     

    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.