Forum Discussion

admin11's avatar
admin11
Icon for Memorable Member rankMemorable Member
4 years ago
Solved

Why variable name COST_M not appear in selection listing ?

Hi All

I have a expression below :-

Current Month -1 GP % = DIVIDE(('DATE'[Current month -1 sales]- 'DATE'[Current Month -1 Cost]),'DATE'[Current month -1 sales])
it return 100 % , which is wrong. see below image :-

 

In order to find out where go wrong , i look into 2 expression as below :-

 
Current month -1 sales =
VAR _MIN =
EOMONTH ( TODAY (), -2 ) + 1
VAR _MAX =
EOMONTH ( TODAY (), -1 )
RETURN
TOTALYTD (
( [SALES_] ),
'DATE'[Date],
FILTER ( 'DATE', AND ( 'DATE'[Date] >= _MIN, 'DATE'[Date] <= _MAX ) )
)
 
Current Month -1 Cost =
VAR _MIN =
EOMONTH ( TODAY (), -2 ) + 1
VAR _MAX =
EOMONTH ( TODAY (), -1 )
RETURN
TOTALYTD (
( [COS] ),
'DATE'[Date],
FILTER ( 'DATE', AND ( 'DATE'[Date] >= _MIN, 'DATE'[Date] <= _MAX ) )
)
 

The reason are cause by SALES_ and COS. 

 

As recently i have append 2 different table into one table. which i need to create below expression :-

SALES_M = SUM(SALES[SALES_SYSPRO])+SUM(SALES[SALES_])
COST_M = SUM(SALES[COST_SYSPRO])+SUM(SALES[COS])
 
Once i replace expression to below , it work fine :-
 
Current month -1 sales =
VAR _MIN =
EOMONTH ( TODAY (), -2 ) + 1
VAR _MAX =
EOMONTH ( TODAY (), -1 )
RETURN
TOTALYTD (
( [SALES_M] ),
'DATE'[Date],
FILTER ( 'DATE', AND ( 'DATE'[Date] >= _MIN, 'DATE'[Date] <= _MAX ) )
)
 
Current Month -1 Cost =
VAR _MIN =
EOMONTH ( TODAY (), -2 ) + 1
VAR _MAX =
EOMONTH ( TODAY (), -1 )
RETURN
TOTALYTD (
( [COST_M] ),
'DATE'[Date],
FILTER ( 'DATE', AND ( 'DATE'[Date] >= _MIN, 'DATE'[Date] <= _MAX ) )
)
 
My question is why COST_M not appear in selection listing below :-
 

 

  • Hi admin11 

     

    Did I get your question correctly, check this image:

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

    Appreciate your Kudos!! 

    LinkedIn | Twitter | Blog | YouTube 

2 Replies

  • Hi admin11 

     

    Did I get your question correctly, check this image:

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

    Appreciate your Kudos!! 

    LinkedIn | Twitter | Blog | YouTube 

    • admin11's avatar
      admin11
      Icon for Memorable Member rankMemorable Member

      VahidDM @You have very sharp eye. The first time when I try , it does not appear . When I try to post this question it appear .