cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jr3151006
Helper IV
Helper IV

DAX Help - how to add another condition on the current filter

Hi,

can someone help me to add a second condition filter??
I tried many time in different ways but no sucess.

 

MeasureXYZ = CALCULATE(
			DISTINCTCOUNT ( TABLE1[Número] ),
							FILTER(
								VALUES(
									TABLE1[Date]),TABLE1[Date]=CALCULATE([Measure-LatestDate],all(TABLE1[Date]))))

 

 

I need also add the following 'FIELD' + 'Condition' as bellow:

 

TABLE1[Consider]="Inativo"

 

 

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @jr3151006 ,

 

According to the error message you provided:

A single value for collumn 'Consider' in table TABLE1 cannot be determined.

I think the problem is caused by the field 'Consider' in table TABLE1 not outputting a unique value in the current context of your metric, and after checking your code, I think the problem is in this code snippet.

TABLE1[Date]=CALCULATE([Measure-LatestDate],all(TABLE1[Date]))

If it is convenient, you need to make sure that the parameter [Measure-LatestDate] placed here is a metric or a calculated column? If it is a calculated column, you need to avoid the error by nesting the functions as described in the error description, and if it is a metric, then we can make sure that the output of the metric is an aggregate value, and you can upload the source data to us to check the problem in detail.

Refer to:

MINX function (DAX) - DAX | Microsoft Learn

MAXX function (DAX) - DAX | Microsoft Learn

SUMX function (DAX) - DAX | Microsoft Learn

COUNTX function (DAX) - DAX | Microsoft Learn

 

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.

vicky_
Memorable Member
Memorable Member

use the && in the filter condition.

So it would look something like CALCULATE(... FILTER(VALUES(Table), condition1 && condition2))...

oh no....

A single value for collumn 'Consider' in table TABLE1 cannot be determined. This can happen when a measure formula refers to a collumn that contais many values without specifying an aggregation such as min, maxm countm or sum to get a single result

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Top Solution Authors