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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
nagoor
Helper III
Helper III

Trend down analysis

Dear Experts, 

 

Hope everyone is good..!! 

 

I came across one requirement to find the trend down analysis compared with the last 30 days data, i have manage to derive it in excel (attached file). Could someone help me to get the similar results in Power bi and advise it is possible to perform here. 

 

The concept is to find the trend down on the last day compared with the last 30 days finding median and ABS, with the Threshold identified based on that..

 

 

https://www.dropbox.com/scl/fi/v2itvpt42hb8rjczwn413/Sample-File.xlsx?dl=0&rlkey=ec31pkfm8k10cfvmfrw...  

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @nagoor 

 

I recreated my measures. I tried to make the measures as reusable as possible.
Here are my measures:

30daysTable:

_30daysTable = 
var _30day=[_maxDate]-1
var _t=ADDCOLUMNS('Table',"maxdate",[_maxDate])
var _t1=
    FILTER(
        FILTER(_t,'Table'[Product Name]="AA1"),
        'Table'[Date]<=_30day&&'Table'[Date]>=_30day-30)
//==========================================================
var _t2=
    FILTER(
        FILTER(_t,'Table'[Product Name]="AA2"),
        'Table'[Date]<=_30day&&'Table'[Date]>=_30day-30)
//==========================================================
// if there are more product, _t3..._tn
var _tt=UNION(_t1,_t2)
// union(t1,t2....tn)
return _tt

Median, ABS, The value of lastest date, Thredshold, Result:

vangzhengmsft_0-1632798124611.png

The above 5 measures are reusable parts, only need to change keywords to become the value of another indicator.
I will not expand it here because it contains a long code, please see the attachment for details.

The part that needs to be modified I include it with an equal line.

eg:

vangzhengmsft_1-1632798519056.png

Result:

vangzhengmsft_2-1632798653938.png

The reusable part, I've considered whether to implement it with a calculation group, but unfortunately the tabular editor doesn't work on my machine. Maybe you can go ahead and implement it.

 

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng
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

7 REPLIES 7
v-angzheng-msft
Community Support
Community Support

Hi, @nagoor 

 

Is the above answer helpful to you?
could you please mark the post which help as Answered? It means a lot to me, and it will help the others in the community find the solution easily if they face the same problem with you. Thank you.

 

 

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

Hi @v-angzheng-msft , 

 

Thanks for your support, it worked well.. 🙂 

 

 

v-angzheng-msft
Community Support
Community Support

Hi, @nagoor 

 

I recreated my measures. I tried to make the measures as reusable as possible.
Here are my measures:

30daysTable:

_30daysTable = 
var _30day=[_maxDate]-1
var _t=ADDCOLUMNS('Table',"maxdate",[_maxDate])
var _t1=
    FILTER(
        FILTER(_t,'Table'[Product Name]="AA1"),
        'Table'[Date]<=_30day&&'Table'[Date]>=_30day-30)
//==========================================================
var _t2=
    FILTER(
        FILTER(_t,'Table'[Product Name]="AA2"),
        'Table'[Date]<=_30day&&'Table'[Date]>=_30day-30)
//==========================================================
// if there are more product, _t3..._tn
var _tt=UNION(_t1,_t2)
// union(t1,t2....tn)
return _tt

Median, ABS, The value of lastest date, Thredshold, Result:

vangzhengmsft_0-1632798124611.png

The above 5 measures are reusable parts, only need to change keywords to become the value of another indicator.
I will not expand it here because it contains a long code, please see the attachment for details.

The part that needs to be modified I include it with an equal line.

eg:

vangzhengmsft_1-1632798519056.png

Result:

vangzhengmsft_2-1632798653938.png

The reusable part, I've considered whether to implement it with a calculation group, but unfortunately the tabular editor doesn't work on my machine. Maybe you can go ahead and implement it.

 

Please refer to the attachment below for details. Hope this helps.

 

 

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

nagoor
Helper III
Helper III

Thanks for your support @v-angzheng-msft  

 

However, if there are multiple Products, it doesnt work with this way 😞 

 

Also, is there any simple way if we have multiple KPIs too, like System availbility, System usage and other Key parameters are there ?

 

really appreciate your support. 

 

 

Hi, @nagoor 

 

An indicator requires at least one measure.
Please consdier sharing more details about it or a simple sample file without any sesentive information  so that i may work out with a workaround.

Best Regards,
Community Support Team _ Zeon Zheng

HI @v-angzheng-msft , 

 

Thanks for your support.. 

 

Please find the attached sample file and help me to get it in power bi

 

Sample File 2 

v-angzheng-msft
Community Support
Community Support

Hi, @nagoor 

 

1. create a measure to get the lastest date:

_The date = CALCULATE(MAX('Table'[Date]),ALLSELECTED('Table'))

2. create a calculate table(30days):

30days = 
var _30date=[_The date]-1
var _t=FILTER(ALLSELECTED('Table'),'Table'[Date]<=_30date&&'Table'[Date]>=_30date-30)
return _t

3. Median:

_Median = CALCULATE(MEDIAN('30days'[System Availability (%)]),ALL('30days'))

4. ABS:

_(ABS) = ABS(MIN('30days'[System Availability (%)])-[_Median])
_ABS = 
var _t=SELECTCOLUMNS('30days',"Date",[Date],"Product Name",[Product Name],"abs",[_(ABS)])
var _t29=FILTER(_t,[Date]<[_The date]-1)
return MEDIANX(_t29,[abs])

5. Thredshold:

Defination = -1
_Threshold = [_Median]+[Defination]*[_ABS]*3.7

6. Result:

Results = 
var _maxDate_value=CALCULATE(MAX('Table'[System Availability (%)]),FILTER(ALL('Table'),'Table'[Date]=[_The date]))
var _if=IF([Defination]=-1,IF(_maxDate_value<[_Threshold],1,0),IF(_maxDate_value>[_Threshold],1,0))
return _if

 

So we get the result like this:

vangzhengmsft_0-1632726321273.png

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors