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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
FPP
Frequent Visitor

Getting an error when trying to add an extra filter

Hi All, This is working:

Avg Paid =
Var PaidAvg =
AVERAGEX (
CALCULATETABLE (
SUMMARIZE (
FILTER ('Transactions', 'Transactions'[isRowFilter] = 1),
'Transactions'[Month],
"TotalPaid", DISTINCTCOUNT ('Transactions'[Group])
),
ALL ('Transactions'[LineItem]),
ALL ('Calendar'[MonthYearLong]),
USERELATIONSHIP ('Calendar'[Date], 'Transactions'[Closed Date])
),
[TotalPaid]
)

RETURN PaidAvg


However

Var PaidAvg =
AVERAGEX (
CALCULATETABLE (
SUMMARIZE (
FILTER ('Transactions', 'Transactions'[isRowFilter] = 1),
'Transactions'[Month],
"TotalPaid", DISTINCTCOUNT('Transactions'[Group])
),
[TotalPaid]<>0,
ALL ('Transactions'[LineItem]),
ALL ('Calendar'[MonthYearLong]),
USERELATIONSHIP ('Calendar'[Date], 'Transactions'[Closed Date])
),
[TotalPaid]
)

RETURN PaidAvg

is given me the error:
The value for 'TotalPaid' cannot be determined. Either the column doesn't exist, or there is no current row for this column.

I do not want to count the Group if the Total of Paid is 0 for that group.

How do I add the higher level filter?

1 ACCEPTED SOLUTION

Thanks, I modified your code and this works:

Avg Paid =
AVERAGEX ( FILTER ( 
    CALCULATETABLE (
        SUMMARIZE (
            FILTER ( 'Transactions', 'Transactions'[isRowFilter] = 1 ),
            'Transactions'[Month],
            "TotalPaid", DISTINCTCOUNT ( 'Transactions'[Group] )
        ),
        ALL ( 'Transactions'[LineItem] ),
        ALL ( 'Calendar'[MonthYearLong] ),
        USERELATIONSHIP ( 'Calendar'[Date], 'Transactions'[Closed Date] )
    ),
[TotalPaid] <> ), [TotalPaid] )
RETURN
    PaidAvg

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @FPP ,

Please update the formula of your measure [Avg paid] as below and check whether that is what you want...

Avg Paid =
VAR _tab =
    CALCULATETABLE (
        SUMMARIZE (
            FILTER ( 'Transactions', 'Transactions'[isRowFilter] = 1 ),
            'Transactions'[Month],
            "TotalPaid", DISTINCTCOUNT ( 'Transactions'[Group] )
        ),
        ALL ( 'Transactions'[LineItem] ),
        ALL ( 'Calendar'[MonthYearLong] ),
        USERELATIONSHIP ( 'Calendar'[Date], 'Transactions'[Closed Date] )
    )
VAR PaidAvg =
    AVERAGEX ( FILTER ( _tab, [TotalPaid] > ), [TotalPaid] )
RETURN
    PaidAvg

If the above one can't help you get the desired result, please provide some sample data in your Transactions table  (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks, I modified your code and this works:

Avg Paid =
AVERAGEX ( FILTER ( 
    CALCULATETABLE (
        SUMMARIZE (
            FILTER ( 'Transactions', 'Transactions'[isRowFilter] = 1 ),
            'Transactions'[Month],
            "TotalPaid", DISTINCTCOUNT ( 'Transactions'[Group] )
        ),
        ALL ( 'Transactions'[LineItem] ),
        ALL ( 'Calendar'[MonthYearLong] ),
        USERELATIONSHIP ( 'Calendar'[Date], 'Transactions'[Closed Date] )
    ),
[TotalPaid] <> ), [TotalPaid] )
RETURN
    PaidAvg

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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