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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
admin11
Memorable Member
Memorable Member

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 :-
admin11_0-1657405263300.png

 

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 :-
 
admin11_1-1657406238184.png

 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @admin11 

 

Did I get your question correctly, check this image:

VahidDM_0-1657413245703.png

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @admin11 

 

Did I get your question correctly, check this image:

VahidDM_0-1657413245703.png

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

@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 . 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors