+ Reply to Thread
Results 1 to 8 of 8

Power Query/Power Pivot Conditional Column creation & chart

  1. #1
    Registered User
    Join Date
    08-16-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    22

    Power Query/Power Pivot Conditional Column creation & chart

    Hi

    Please see the attached file and see below the steps I would like to achieve in this file by power query or power pivot so it is automated when a new month data comes in monthly. I need these if conditions to create a red, yellow, and green dynamic pivot chart. I would really appreciate your help in achieving it.




    After the above steps, pivot chart to create example below:
    Last edited by AliGW; 12-12-2020 at 06:06 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Power Query/Power Pivot Conditional Column creation & chart

    To calculate the average for the most recent three months, here is an example. I used greater thatn 30 days and less than 120 days from today. You will need to adjust this to exactly what you want. All of your data is for periods greater than a month old. It is beneficial to us that are offering help that your requests are realistic to the data provided to test.

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    08-16-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    22

    Re: Power Query/Power Pivot Conditional Column creation & chart

    Hi Alan,

    Thank you so much for your reply and taking time out. I really appreicate. Would it be possible if you could do this in the file i provided, since kinda lost. Also, confused on greater than 30days and 120 days sinceI want to calculate the average for last 3 months, dynamically (pivot table), which means with every new month and rate added in the table, it automatically adjusts the periods to calculate the average for last 3 months excluding the current month. . I basically need the exact results below since when I did it it, it didn't work and also the conditions didn't work at all. Please see the exact steps I need to acheive below:

    Exact steps for the results need to be in a pivot table format:

    1. I have 2 columns in the attached file, Month and Rate. I want to get the previous 3 months average in a column(excluding the current month) so For example in the file for month and rate column:
    for the current month 20-Oct -(72%), I want only the previous 3 months rate average for 20Sept-(79%), 20Aug-(76%), 20Jul-(85%) .

    2. After the 1st step above, populate percentages in the columns for if conditions or NA.

    -If last 3 months average is greater than or equal to current month then populate the percentage or NA. (GREEN IF CONDITION)
    -if the 3 months average for previous months less than the current month then (RED IF CONDITION)
    -If greater than or equal to 95% to 100% (YELLOW IF CONIDTION)
    Attached Files Attached Files
    Last edited by mz_h; 12-07-2020 at 01:08 AM. Reason: file attached

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Power Query/Power Pivot Conditional Column creation & chart

    Sorry, I have been playing with this for a couple of hours and cannot get a valid solution to determine latest three months. I don't really understand the second condition. However if you want to use =Averageifs function, then convert your table to a range and place this formula in C2 =AVERAGEIFS(Source!$B$2:$B$398,Source!$A$2:$A$398,">=8/1/2020",Source!$A$2:$A$398,"<=12/1/2020")

    FYI, I don't work with Graphs/charts so I am no help there.

    Good Luck with finding a solution that works for you.

  5. #5
    Registered User
    Join Date
    08-16-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    22

    Re: Power Query/Power Pivot Conditional Column creation & chart

    Thanks so much for looking into it, hoping that someone else could help me out.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: Power Query/Power Pivot Conditional Column creation & chart

    Perhaps, considering several days have past, a formula based (partial) solution may help.
    1. The months are listed using: =MIN(Table1[Date]) and =EDATE(F4,1)
    2. The percentage of the current month is displayed using: =AVERAGEIFS(Table1[Rate],Table1[Date],">="&F4,Table1[Date],"<="&EOMONTH(F4,0))
    3. The percentage of the previous three months is displayed using: =IF(OR(ISTEXT(G1),G1=""),NA(),AVERAGE(G1:G3))
    4. The chart is a line graph with markers with a RAG background, however I don't know how to make the background dynamic (thus this is a "partial" solution).
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  7. #7
    Registered User
    Join Date
    08-16-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    22

    Re: Power Query/Power Pivot Conditional Column creation & chart

    Thank you so much! This is exactly what I was looking for and I will work around it to make it dynamic and automated. Thanks so much

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: Power Query/Power Pivot Conditional Column creation & chart

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] 2 fields checker- Request for alternative option in Power Query or Power Pivot
    By Shareez Saleem in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-15-2020, 08:36 AM
  2. Replies: 10
    Last Post: 06-25-2020, 12:19 AM
  3. Power Query / Power pivot : M2M relationships problem
    By almourasel in forum Excel General
    Replies: 6
    Last Post: 03-26-2020, 05:33 PM
  4. [SOLVED] Power Pivot does not load new column added in Power query
    By ibuhary in forum Excel General
    Replies: 12
    Last Post: 02-19-2019, 03:53 AM
  5. Power Query and Power Pivot Table !!
    By haitham.shop in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2018, 06:15 AM
  6. POWER Query and Power Pivot Table !!
    By haitham.shop in forum Access Tables & Databases
    Replies: 0
    Last Post: 08-06-2018, 05:59 AM
  7. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1