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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
DharmaChinta
Frequent Visitor

calculate the percentage change from week on week

 Hi Team , Need some help on DAX Measure to find data of previous record for each piece of data in a time series . Here is the sample data  , the actual requirement here is to calculate the percentage change from week on week by comparing with the previous value of the same step  i think for this we might need previous value . Please help me here .

 

consumerdomainnotallowed  12/8/2018 18344

consumerdomainnotallowed  12/1/2018 16724

1 ACCEPTED SOLUTION

Hi @DharmaChinta,

Based on my test, you could refer to below formula:

Create two columns:

Weeknum = WEEKNUM('Table1'[week])
Column 2 = var a=[Weeknum]+1
return CALCULATE(SUM(Table1[ErrorCount]),FILTER('Table1','Table1'[Weeknum]=a&&'Table1'[stepName]=EARLIER(Table1[stepName])))

Result:

1.PNG

Or you could use below measure:

Measure = var a=CALCULATE(SUM(Table1[Weeknum]))+1
return CALCULATE(SUM(Table1[ErrorCount]),FILTER(ALL('Table1'),'Table1'[Weeknum]=a&&'Table1'[stepName]=MAX(Table1[stepName])))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

 

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-danhe-msft
Employee
Employee

Hi @DharmaChinta,

Based on my test, you could refer to below steps to show the changed value:

Sample data:

1.PNG

Create two calculated columns:

Week = WEEKNUM('Table1'[Date],2)
Change value = var a=[Week]+1
return IF(ISBLANK(CALCULATE(SUM(Table1[Value]),FILTER('Table1','Table1'[Week]=a))),BLANK(),[Value]-CALCULATE(SUM(Table1[Value]),FILTER('Table1','Table1'[Week]=a)))

Result:

1.PNG

 

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for your reply , the problem here is i do have a column like step name . So for each step name i need to calculate the difference with the previous week value .

 

stepName last4Weeks week ErrorCount
genericerror 2018-11-24 00:00:00.0000000 2018-12-15 00:00:00.0000000 207
AdminTenantInfoSystemError from AdminTrialNew 2018-11-24 00:00:00.0000000 2018-12-15 00:00:00.0000000 64

genericerror 2018-11-24 00:00:00.0000000 2018-12-08 00:00:00.0000000 235
AdminTenantInfoSystemError from AdminTrialNew 2018-11-24 00:00:00.0000000 2018-12-08 00:00:00.0000000 92

 

Can you please check and help me here .

Hi @DharmaChinta,

Based on my test, you could refer to below formula:

Create two columns:

Weeknum = WEEKNUM('Table1'[week])
Column 2 = var a=[Weeknum]+1
return CALCULATE(SUM(Table1[ErrorCount]),FILTER('Table1','Table1'[Weeknum]=a&&'Table1'[stepName]=EARLIER(Table1[stepName])))

Result:

1.PNG

Or you could use below measure:

Measure = var a=CALCULATE(SUM(Table1[Weeknum]))+1
return CALCULATE(SUM(Table1[ErrorCount]),FILTER(ALL('Table1'),'Table1'[Weeknum]=a&&'Table1'[stepName]=MAX(Table1[stepName])))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

 

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Man used saved my life , thanks for all your help!!!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.