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

Help with DAX formula, calculate % of growth in the last 7 days

Hi Guys,

 

Please, need help with a DAX Formula, this is the table in PowerBI

 

array_namefs_nameTotal GBUsed GBFree GBUsed%Last Collection Date
UKLONRAPVNX01FS_UKLONDEYFS09_01787878780100,00%19/12/2018 00:00
USSECSFVNX001test_SNMP_TEMP3550100,00%19/12/2018 00:00
USSECSFVNX001FS_USSECVAPFL43_0214771147234899,68%19/12/2018 00:00
INDELHMEYNAS02Del_TAXFS01622662012599,60%19/12/2018 00:00
INDELHMEYNAS02Del_AuditFS0117461738899,54%19/12/2018 00:00
INGURSUVNX001FS_INGURVAPFL10_01814180865599,32%19/12/2018 00:00
USSECSFVNX001FS_USSECVAPFL35_0110084100038099,20%19/12/2018 00:00
INDELHMEYNAS02Del_TASFS01246244299,19%19/12/2018 00:00
INDELHMEYNAS02DEL_AFS01485048084299,13%19/12/2018 00:00
DEFRNSFVNX001FR_DEFRANMCEFL08_04139341358634897,50%19/12/2018 00:00
CATORVNX02FS_CATORVAPFL50_08201719338495,84%19/12/2018 00:00
SGSINSFVNX003FS_SGSINVAPFL20_093592342716595,41%19/12/2018 00:00
DERUSSFVNX007FS_DEFRAVAPFL21_01161171513498493,90%19/12/2018 00:00
DEFRNSFVNX001FR_DEFRANMCEFL08_03141171313398493,03%19/12/2018 00:00
CATORVNX02FS_CATORVAPFL21_037878731256592,82%19/12/2018 00:00
ZAJOHRAPVNX01FS_ZAJOHAMEYNAS03110921020189191,97%19/12/2018 00:00
DERUSSFVNX007FS_DEFRAVAPFL21_081563014332129891,70%19/12/2018 00:00
INHYDRAPVNX01FA_INHYDVAPFL10_056050552352891,29%19/12/2018 00:00
DEFRNSFVNX001FR_DEFRANMCEFL08_019847895489490,93%19/12/2018 00:00
CATORVNX02FS_CATORVAPFL11_017878713474490,56%19/12/2018 00:00
DEFRNSFVNX007FS_DEFRAVAPFL14_011139510297109890,36%19/12/2018 00:00
DEFRNSFVNX001FR_DEVIDVAPFL35_0110084908499990,08%19/12/2018 00:00

 

 

 

So as you can see i have the columns fs_name, used_GB, Total GB, Free GB, Used %.  So i would like to add other column with the % used space Growth in the las 7 days, and also in the las 15 days, 

 

The idea will to create a dax to calculate the % used in the erlierst date and then substract with the today % used information.

 

 

Thank you!

 

 

 

 

 

 

1 ACCEPTED SOLUTION

hi, @Anonymous

First, the last 7 day is the calculation beetween the "today date" and the 7 day back

The idea is to use fs_name from table example_1 

 

Check the last date: 8/1/2019 00:00  and compare the value used_per with the previus date of 7 day before, 30/12/2018 00:00 

for your example,

today date (8/01/2019) is the max date of [Last Collection Date] ? and the last 7 days (30/12/2019) is (today date -9)?

If so you could try use this formula to create a column as below:

Column = var _maxday=CALCULATE(MAX(Table1[Last Collection Date]),FILTER(Table1,Table1[fs_name]=EARLIER(Table1[fs_name])))return
CALCULATE(SUM(Table1[Used%]),FILTER(Table1,Table1[fs_name]=EARLIER(Table1[fs_name])&&Table1[Last Collection Date]=_maxday))-
CALCULATE(SUM(Table1[Used%]),FILTER(Table1,Table1[fs_name]=EARLIER(Table1[fs_name])&&Table1[Last Collection Date]=_maxday-9))

and  if last 7 day date is not (_maxday-9), you could adjust it by yourself.

9.JPG

 

Best Regards,

Lin

 

 

 

 

 

 

 

Community Support Team _ Lin
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

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi, @Anonymous

What is your expected output? what is "the last 7 days"?  is it the last 7 days of max([Last Collection Date]) for each [fs_name]?

Please share some data sample and expected output. This will help us better understand your needs.

 

 

Best Regards,

Lin

 

 

 

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

hi @v-lili6-msft thanks for your answer,

 

the last 7 day is the calculation beetween the "today date" and the 7 day back, 

 

Example: 

 

table example_1:

 

fs_nameTotal GBUsed GBFree GBUsed%Last Collection DateUsed_Per
FR_DEFRANMCEFL08_03141171318193693,37%8/1/2019 00:0093,37%
FR_DEFRANMCEFL08_03141171316695193,26%7/1/2019 00:0093,26%
FR_DEFRANMCEFL08_03141171315995993,21%6/1/2019 00:0093,21%
FR_DEFRANMCEFL08_03141171315895993,21%4/1/2019 00:0093,21%
FR_DEFRANMCEFL08_03141171315895993,21%5/1/2019 00:0093,21%
FR_DEFRANMCEFL08_03141171314996993,14%3/1/2019 00:0093,14%
FR_DEFRANMCEFL08_03141171314797093,13%2/1/2019 00:0093,13%
FR_DEFRANMCEFL08_03141171314397493,10%31/12/2018 00:0093,10%
FR_DEFRANMCEFL08_03141171314397493,10%1/1/2019 00:0093,10%
FR_DEFRANMCEFL08_03141171314197693,09%28/12/2018 00:0093,09%
FR_DEFRANMCEFL08_03141171314197693,09%29/12/2018 00:0093,09%
FR_DEFRANMCEFL08_03141171314197693,09%30/12/2018 00:0093,09%
FR_DEFRANMCEFL08_03141171314097793,08%27/12/2018 00:0093,08%
FR_DEFRANMCEFL08_03141171313997993,07%21/12/2018 00:0093,07%
FR_DEFRANMCEFL08_03141171313997993,07%22/12/2018 00:0093,07%
FR_DEFRANMCEFL08_03141171313997993,07%23/12/2018 00:0093,07%
FR_DEFRANMCEFL08_03141171313997893,07%24/12/2018 00:0093,07%
FR_DEFRANMCEFL08_03141171313997893,07%25/12/2018 00:0093,07%
FR_DEFRANMCEFL08_03141171313997893,07%26/12/2018 00:0093,07%
FR_DEFRANMCEFL08_03141171313897993,07%20/12/2018 00:0093,07%
FR_DEFRANMCEFL08_03141171313398493,03%19/12/2018 00:0093,03%
FR_DEFRANMCEFL08_03141171311899992,92%18/12/2018 00:0092,92%
FR_DEFRANMCEFL08_031411713116100192,91%17/12/2018 00:0092,91%

 

The idea is to use fs_name from table example_1 

 

Check the last date: 8/1/2019 00:00  and compare the value used_per with the previus date of 7 day before, 30/12/2018 00:00 

 

 

The value from 30/12/2018 is = 93,09%

The value from 8/01/2019 is = 93,37 % 

 

So the result would be = 93,37 % - 93,09% = 0,28 %

in that case in the last 7 days the fs_name growth in space 0,28% 

 

The idea would be have a dax  to place the result in the same table of example, with the name of the column " 7 days growth " 

 

Thanks

hi, @Anonymous

First, the last 7 day is the calculation beetween the "today date" and the 7 day back

The idea is to use fs_name from table example_1 

 

Check the last date: 8/1/2019 00:00  and compare the value used_per with the previus date of 7 day before, 30/12/2018 00:00 

for your example,

today date (8/01/2019) is the max date of [Last Collection Date] ? and the last 7 days (30/12/2019) is (today date -9)?

If so you could try use this formula to create a column as below:

Column = var _maxday=CALCULATE(MAX(Table1[Last Collection Date]),FILTER(Table1,Table1[fs_name]=EARLIER(Table1[fs_name])))return
CALCULATE(SUM(Table1[Used%]),FILTER(Table1,Table1[fs_name]=EARLIER(Table1[fs_name])&&Table1[Last Collection Date]=_maxday))-
CALCULATE(SUM(Table1[Used%]),FILTER(Table1,Table1[fs_name]=EARLIER(Table1[fs_name])&&Table1[Last Collection Date]=_maxday-9))

and  if last 7 day date is not (_maxday-9), you could adjust it by yourself.

9.JPG

 

Best Regards,

Lin

 

 

 

 

 

 

 

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

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.