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
MontsePuig
Frequent Visitor

% Variation of week sessions

Hi,

I need to create a variation % between the current week and the previous week. In excel formula ((sessions - (sessions-1)) / (sessions-1). But, I don't know with DAX expressions. Smiley Sad

This is a table


week.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

And this is a result that I want. Thank's for help Smiley Happy !!


week-ok.png

 

 

 

 

 

 

 

2 REPLIES 2
v-caliao-msft
Employee
Employee

Hi @MontsePuig,

 

You can use Lookupvalue function to get last week session. Lookupvalue returns the value in result_columnName for the row that meets all criteria specified by search_columnName and search_value.
LOOKUPVALUE( <result_columnName>, <search_columnName>, <search_value>[, <search_columnName>, <search_value>]…) 

 

Test data Table
Capture.PNG

Create a table by using DAX below.
Table 2 = SUMMARIZE('Table','Table'[Year],'Table'[Week],"WeekTotal",CALCULATE(SUM('Table'[Sessions]),ALLEXCEPT('Table','Table'[Year],'Table'[Week])))
Create two calculated column.
LastWekkSession = LOOKUPVALUE('Table 2'[WeekTotal],'Table 2'[Year],'Table 2'[Year],'Table 2'[Week],'Table 2'[Week]-1)
Var Session = FORMAT(('Table 2'[WeekTotal]-'Table 2'[LastWekkSession])/'Table 2'[LastWekkSession],"0.00%")

Capture1.PNG

 

Regards,

Charlie Liao

Hi, @v-caliao-msft , thank you very much for your help!!

 

This is a result, thanks Smiley Happy 

variation.png

But, now, I have problem with the relationship new table 2 between table. You can see this file.

 

 

relationship.png

 

Thank's

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.