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
mr_oli
Helper I
Helper I

How to calculate trend based on 3 last month and display in table

Hello guys!

 

I have to calculate trend based on last 3 months and then (if possible) display that trend as arrow (red, orange, black) in table.

My data looks like this:

SupplierDateDefect Type
A01.11.20204
B01.10.20203
B02.10.20202
B03.10.20201
B01.11.20201
B02.11.20201
B01.12.20204
C01.11.20205

 

and i want to achive sth like this:

wo6YnvD

 

btw - how to add pbix file here?

 

 

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

Hi, @mr_oli 

You can try to  create a summarize calculated table  :

 

New Table =
SUMMARIZE (
    'Table',
    'date'[Date],
    'date'[Date].[Year],
    'date'[Date].[Month],
    'date'[Date].[MonthNo],
    'Table'[Supplier],
    "Count Defect Type", COUNT ( 'Table'[Defect Type] )
)

 

 Then create a calculated column applied to the icon conditional formatting:

 

Percentage = 
IF (
    ISBLANK ( 'New Table'[Previous Count Defect Type] ),
    BLANK (),
    'New Table'[Count Defect Type] / 'New Table'[Previous Count Defect Type]
)

 

19.png

 

 

Please check my sample pbix for more details.

If it doesn't meet your requirement, please let me know .You can also upload your sample file to Onedrive for Bussiness then share the link here.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

4 REPLIES 4
v-easonf-msft
Community Support
Community Support

Hi, @mr_oli 

You can try to  create a summarize calculated table  :

 

New Table =
SUMMARIZE (
    'Table',
    'date'[Date],
    'date'[Date].[Year],
    'date'[Date].[Month],
    'date'[Date].[MonthNo],
    'Table'[Supplier],
    "Count Defect Type", COUNT ( 'Table'[Defect Type] )
)

 

 Then create a calculated column applied to the icon conditional formatting:

 

Percentage = 
IF (
    ISBLANK ( 'New Table'[Previous Count Defect Type] ),
    BLANK (),
    'New Table'[Count Defect Type] / 'New Table'[Previous Count Defect Type]
)

 

19.png

 

 

Please check my sample pbix for more details.

If it doesn't meet your requirement, please let me know .You can also upload your sample file to Onedrive for Bussiness then share the link here.

 

Best Regards,
Community Support Team _ Eason

parry2k
Super User
Super User

@mr_oli Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

amitchandak
Super User
Super User

@mr_oli , what is the basis of arrow and color. Month vs month. Three month avg vs current month , three vas last three ?

thank you for you answer

I discovered that comparing 3 months wont work, so I need to compare last month versus -2 month from current date

I think that I will use solution from this link:
https://community.powerbi.com/t5/Desktop/Unable-to-display-trend-arrows-in-table-visual/td-p/138572 

But the problem is that I can't create a measure to sum number of defects from previous date range (in my example whole month) which will be looking for current date.

I tried something like this:

Defects Previous Mo = CALCULATE(SUM('table'[Number of Defects]),DATEADD('date'[Date],-1,MONTH))
but this will work only with page filter and I need a measure to calculate sum of defects from whole December (because today we have January) versus second measure which will count sum of defects from whole November (current month minus 2)

 

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.