Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

why does a measure changes its result when lines on a Table are selected and how to prevent that ?

Hello,

I have a dashboard with 2 visuals : one Table and one Card.

The table displays the content of "Query A".

In that query A, I have added a Measure :

NbNumberInDoubloon = COUNTROWS('Query A')

It works OK, except when lines are selected in the Table visual, the Card changes its display. It recalculates according to the lines selected and not anymore to the whole content of "Query A".

If it matters, this measure is added within the query, not in a separate query/table that would contain only the measures (I think it is possible that's why I say that).

The code of my measure refers to "Query A" in its globality, so why does it change when lines are selected ? Why are they linked ? And how can I make sure it displays all the time the number of rows of the whole table ?

Thanks for your help,

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

This calculation altough refers to the total table is based on the values of the selection meaning that any filters will impact this calculation making a selection of lines in a table is applying a filter to the card.

 

If this metric is only used on this card and you don't want it to change no matter what filters you apply rewrite to:

NbNumberInDoubloon = COUNTROWS(ALL('Query A'))

 

If you want the metric to have impact of the filters expect when you select other visualizations then you must turn off the interaction between the table and the card:

https://learn.microsoft.com/en-us/power-bi/create-reports/service-reports-visual-interactions?tabs=powerbi-desktop


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi @Anonymous ,

 

This calculation altough refers to the total table is based on the values of the selection meaning that any filters will impact this calculation making a selection of lines in a table is applying a filter to the card.

 

If this metric is only used on this card and you don't want it to change no matter what filters you apply rewrite to:

NbNumberInDoubloon = COUNTROWS(ALL('Query A'))

 

If you want the metric to have impact of the filters expect when you select other visualizations then you must turn off the interaction between the table and the card:

https://learn.microsoft.com/en-us/power-bi/create-reports/service-reports-visual-interactions?tabs=powerbi-desktop


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

It works indeed, thank you.

I thought I could apply the same on my other measure that behaves the same :

NbDisctinctNumberInDoubloon = DISTINCTCOUNT('Query A'[phone number])

But whether I use 

NbDisctinctNumberInDoubloon = DISTINCTCOUNT(ALL('Query A')[phone number])

or

NbDisctinctNumberInDoubloon = DISTINCTCOUNT(ALL('Query A'[phone number]))

It gives me error. It doesn't work on the same base ?

 

Hi @Anonymous 

 

Bing a distinct count you need to use a different context:

 

NbDisctinctNumberInDoubloon = CALCULATE(DISTINCTCOUNT('Query A'[phone number]),ALL('Query A'[phone number]) )

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

It's aint working either 😞 When I select 1 line, the value displayed is 1)

Anonymous
Not applicable

Actually, it is just a typo from you I guess, you left the column name in the second argument.

It works fine like this :

NbDisctinctNumberInDoubloon = CALCULATE(DISTINCTCOUNT('Query A'[phone number]),ALL('Query A'))

 I am surprised though that it didn't raise an error with the column name on it.

Hi @Anonymous,

 

The ALL function also works with columns however once again the context is important so if you are using columns from the query a on your table the result can be influenced 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.