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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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