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
Anonymous
Not applicable

I need help

 

Hi, I need SUBTRACT the column [COD] line by line> Example> LINE2 - LINE1; LINE3 - LINE2; LINE4 - LINE3 ....

 

but column [COD] is MEASURE and i do not know how i make it.ajuda.png

 

7 REPLIES 7
Anonymous
Not applicable

@Anonymous I just want to confirm how do you determine whats Line 1 and whats Line 2?

Anonymous
Not applicable

You could create a column for previous day/period COD and then another column which is difference of the 2. 

 

=CALCULATE(SUM[COD], DATEADD(TableName[DateField],-1,day))

 

OR

 

You could get values using the previousday function. https://msdn.microsoft.com/en-us/query-bi/dax/previousday-function-dax

 

OR

 

If you dont know the last date you could calculate previous period using 

 

Last=

VAR LastPeriod= CALCULATE (MAX ( FactName[DimDateKey] ),

        FILTER (FactName, FactName[DimDateKey] <> ( FactName[DimDateKey] )))

RETURN LastPeriod

Anonymous
Not applicable

 

@Anonymous But  COD is INT not DATE .

 

 

I need FILTER DATE and DES_COMPT_PARAD  and CALCULATE  [COD]Line 2 - [COD]Line 1  ; [COD]Line 3 - [COD]Line 2  and etc

Anonymous
Not applicable

@Anonymous I know, that is why I am using it as a sum and not the date field.

Anonymous
Not applicable

@Anonymous I tried and I could not . Can you help ? https://drive.google.com/open?id=1205YLHc1xOjbBftFsJHM2q3irI2X6KbF

Interkoubess
Solution Sage
Solution Sage

Hi @Anonymous,

 

What is the formula for the COD.

 

I also think you cant use Earlier to grab the previous information, but I need to know what COD is before giving a try to the final formula.

 

Ninter

Anonymous
Not applicable

Hi @Interkoubess this formula COD is  :

COD = CALCULATE (min('CORRIDAS'[COD_IDENT_CORRI]);
FILTER (
'CORRIDAS';
'CORRIDAS'[DTH_INIC_CORRI] < MIN ( 'PARADAS'[DTH_INIC_PARAD] )
&& 'CORRIDAS'[DTH_FIM_CORRI] > MIN ( 'PARADAS'[DTH_FIM_PARAD] )
)
)

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.