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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors