Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I want to have a filter that is only applied if there is HASONEVALUE(DimCustomer[Age_Segment1_Code]) to consider all values of the customer segment (this is to ensure that when counting new customers I don't miscount customer who just changed age segment / had a birthday - as opposed to being a genuine new customer)
At the moment I have wrapped an IF around two COUNTROWS which differ only by applying ALL(DimCustomer[Age_Segment1_Code]) in the case where there is HASONEVALUE returns TRUE.
IF (
HASONEVALUE ( DimCustomer[Age_Segment1_Code] ),
COUNTROWS (
FILTER (
VALUES ( FactAccount[Customer_Id] ),
FactAccount[Customer_Id]
IN CALCULATETABLE (
VALUES ( FactAccount[Customer_Id] ),
FILTER (
ALL ( DimDate ),
IF (
MonthYear,
DimDate[Year] = APreviousYear
&& DimDate[Month] = APreviousMonth,
DimDate[Year] + 1 = CurrentYear
)
),
ALL ( DimCustomer[Age_Segment1_Code] )
)
)
),
COUNTROWS (
FILTER (
VALUES ( FactAccount[Customer_Id] ),
FactAccount[Customer_Id]
IN CALCULATETABLE (
VALUES ( FactAccount[Customer_Id] ),
FILTER (
ALL ( DimDate ),
IF (
MonthYear,
DimDate[Year] = APreviousYear
&& DimDate[Month] = APreviousMonth,
DimDate[Year] + 1 = CurrentYear
)
)
)
)
)
)Is there a way of integrating it into the filter itself? (the part in red) :
COUNTROWS (
FILTER (
VALUES ( FactAccount[Customer_Id] ),
FactAccount[Customer_Id]
IN CALCULATETABLE (
VALUES ( FactAccount[Customer_Id] ),
FILTER (
ALL ( DimDate ),
IF (
MonthYear,
DimDate[Year] = APreviousYear
&& DimDate[Month] = APreviousMonth,
DimDate[Year] + 1 = CurrentYear
)
),
IF (HASONEVALUE ( DimCustomer[Age_Segment1_Code] ),
ALL ( DimCustomer[Age_Segment1_Code] ),
DimCustomer[Age_Segment1_Code]
)
)
)
)When I try this option I get the following error:
Cannot convert value '*' of type Text to type True/False
Suggestions welcome!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 5 |
| User | Count |
|---|---|
| 24 | |
| 11 | |
| 9 | |
| 9 | |
| 8 |