user2301821
user2301821

Reputation: 1

I want to do sum of a cost based on the firm number I passed as a filter, in the DAX firm number has mixed values numeric and alphanumeric

In power BI I want to calculate measure based on some filters, Firm number which contains numeric as well as alphanumeric values, and this one is selected by the user in paginated report. I am applying simple filter but gives me error "Cannot convert value 'a1234' of type text to type True/False." My code to calculate measure is

AdminCost = CALCULATE(SUM('LoadCostStmtPayees'[COST]),
                    'Employer Dimensions'[FirmNumber],
                   FILTER('LoadCostStmtPayees',LoadCostStmtPayees[FUNDTYPE]="Administration Fund")
                   )

Please help me How I can apply filter with the alphanumeric values in a filter.

Upvotes: 0

Views: 30

Answers (1)

Sam Nseir
Sam Nseir

Reputation: 12171

This is the issue 'Employer Dimensions'[FirmNumber] in your expression. It is missing the conditional part, without it DAX is assuming a boolean value. Since this is report filter/slicer, you don't need to include it in your calculation.

Try the following:

AdminCost =
  CALCULATE(
    SUM('LoadCostStmtPayees'[COST]),
    LoadCostStmtPayees[FUNDTYPE] = "Administration Fund"
  )

(Note: You don't need to use FILTER and the above is shorthand for the same.)

Upvotes: 0

Related Questions