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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Measure names and trailing spaces ignored in Table variable

I have a table variable like this:

 

VAR _KPITbl =
ADDCOLUMNS (
SUMMARIZE (
FILTER ( 'KPI Performance Measures', [Department] = "Summary" ),
'KPI Performance Measures'[DaxMeasureName]
),
"Perf. KPI Value", CALCULATE ( 'KPI Performance Measures'[KPIPerfMeasuresSummary] )
)

If a value in 'KPI Performance Measures'[DaxMeasureName] contained a trailing space then 'KPI Performance Measures'[KPIPerfMeasuresSummary] doesn't calculate, despite the measure existing with a trailing space

 

I managed to fix this by replacing the trailing space with a period.

.

For context the measure I wanted to calculate is like this:

 

KPIPerfMeasuresSummary =
VAR _TimesFact =
IF ( [C2SelectionIndex] = 1, -1, 1 )
VAR _S1 = [New Sales Volume (Units)]
VAR _S2 = [New Sales Margin]
VAR _S3 = [Used Sales Volume]
VAR _S4 = [Used Sales Margin]
VAR _S5 = [Other Sales Gross Profit]
VAR _S6 = [Sales Expenses]
VAR _S7 = [Service Volume (Hours)]
VAR _S8 = [Service Margin]
VAR _S9 = [Service Expenses]
VAR _S10 = [P, A & GM Volume (Turnover)]
VAR _S11 = [P, A & GM Margin]
VAR _S12 = [P, A & GM Expenses]
VAR _S13 = [Overheads & Interest]
VAR _S14 = [Variable Margin/Dealer Standards Bonus.]
VAR _S15 = [Other Franchise.]
VAR _selectKPI =
IF (
HASONEVALUE ( 'KPI Performance Measures'[DaxMeasureName] ),
VALUES ( 'KPI Performance Measures'[DaxMeasureName] ),
BLANK ()
)
RETURN
SWITCH (
TRUE (),
_SelectKPI = "Blank", BLANK (),
_SelectKPI = "New Sales Volume (Units)", _S1,
_SelectKPI = "New Sales Margin", _S2,
_SelectKPI = "Used Sales Volume", _S3,
_SelectKPI = "Used Sales Margin", _S4,
_SelectKPI = "Other Sales Gross Profit", _S5,
_SelectKPI = "Sales Expenses", _S6,
_SelectKPI = "Service Volume (Hours)", _S7,
_SelectKPI = "Service Margin", _S8,
_SelectKPI = "Service Expenses", _S9,
_SelectKPI = "P, A & GM Volume (Turnover)", _S10,
_SelectKPI = "P, A & GM Margin", _S11,
_SelectKPI = "P, A & GM Expenses", _S12,
_SelectKPI = "Overheads & Interest", _S13,
_SelectKPI = "Harley-Davidson Variable Margin/Dealer Standards Bonus.", _S14,
_SelectKPI = "Other Franchise.", _S15,
BLANK ()
) * _TimesFact

 

Status: Investigating
Comments
Anonymous
Not applicable

Hi @JohnShepherdAPD ,

 

I'm not sure I understand your needs accurately, you can refer to these two threads to see if they help.

 

Solved: Adding spaces in the title/name of a field/measure - Microsoft Power BI Community

Solved: Calculate ignoring filters in variables - Microsoft Power BI Community

 

Best regards.
Community Support Team_ Caitlyn