PowerBI: Display top 5 quarters except first one - powerbi-desktop

I want to display top 5 quarters except the current one. Say top 6 quarters are FY19Q1, FY19Q2, FY19Q3, FY19Q4, FY20Q1, FY20Q2 and current quarter is FY20Q2.
So I want to display line chart for FY19Q1, FY19Q2, FY19Q3, FY19Q4, FY20Q1. That is except the current quarter FY20Q2. Could anyone help me with this. Thanks.

Put your Quarters in the x-Axis and your value (for example: Sales) in a bar chart.
Then simply drag and drop your Quarters into the filter pane of the bar chart and exclude the current quarter.
Update
If you want it variable then add a custom column (Name:CurrQuarterBool) in your query designer with the following formula:
= Date.IsInCurrentQuarter([YourDateColumn])
Now just drag and drop the CurrQuarterBool Column in your filter of the visual.

Related

How can I get my Excel spill range to be grouped by a specific column for a chart?

I need to produce a chart in Excel to show a quantity of items for a number of categories, grouped by the month they were received. At the moment, every occurrence of the Month shows up in my clustered column chart. I can manually do a table and remove all except the first occurrence of each month, but I need it to be done dynamically as the date range can be changed (between 1 and 12 months). I have a full list of data for 12 months, showing Types and their Quantity received. I've filtered the list to just show the types and quantities received between the date range selected (picture 1).
The three images below show the spilled data, the current chart, and how I would like the chart to look. If it cannot be achieved directly using a spill range, then could anyone suggest another approach to have my data dynamically displayed in a chart, grouped by month?
Not a perfect answer but here's a start:
You could paste:
=IF(COUNTIF(F$5:F5,F5)=1, F5,"")
in J5, and drag this down a sufficient way to cover the expected length of the dynamic array.
Then paste:
=CHOOSECOLS(F5#,2,3)
in K5, and use these three columns for your graph data.
I can't think of a way to make the "J" column dynamic at the moment.
EDIT:
Pasting:
=XLOOKUP(ROW(F5#), XMATCH(UNIQUE(CHOOSECOLS(F5#,1)),CHOOSECOLS(F5#,1))+4, UNIQUE(CHOOSECOLS(F5#,1)),"")
in J5 should work dynamically too.

Excel Generating a table based on positions in another table

I have a forecast for a number of countries, and I want to simulate how different launch years for these countries will impact the total sales for each year.
Say I have these forecasts for each market (Denmark, Norway and Finland):
What I would like to achieve, is to be set the launch year in a setup table like this:
And then finally end with a table, where each country's forecast is repositioned according to the launch year I define in the previous setting. This would ultimately look like this, based on my example:
I.e. the first year of Denmark's forecast is shown in year one (based on the input from cell H2), the first year of Norway's forecast is shown in year 3 (based on the input from cell H3) and vice versa for Finland.
So with this in hand, the last table (in A8:E11) will update when I change the inputs for launch year in each country.
Do you know of a good way to do this in Excel?
As #JosephMason said. INDEX/MATCH will return your figures.
Simple version:
In cell B9 in your example:
=IF(B$8-$H2+1<=0,0,INDEX($B$2:$E$4,1,B$8-$H2+1))
Cell B10:
=IF(B$8-$H3+1<=0,0,INDEX($B$2:$E$4,2,B$8-$H3+1))
Cell B11:
=IF(B$8-$H4+1<=0,0,INDEX($B$2:$E$4,3,B$8-$H4+1))
Slightly more complex version:
So you don't need to change the row number in the INDEX function (entered in B9 and dragged across/down):
=IF(B$8-$H2+1<=0,0,INDEX($B$2:$E$4,MATCH($A9,$A$2:$A$4,0),B$8-$H2+1))
Looks it all up version:
So the order of countries in G2:G4 doesn't matter:
=IF(B$8-INDEX($H$2:$H$4,MATCH($A9,$G$2:$G$4,0))+1<=0,0,INDEX($B$2:$E$4,MATCH($A9,$A$2:$A$4,0),B$8-INDEX($H$2:$H$4,MATCH($A9,$G$2:$G$4,0))+1))
I would use an INDEX function with a MATCH function for the row referencing on the country, and another MATCH function for the year column referencing off your input.
The simplest way to do this that I can think of now is via pivot.
First you will need to redimension this table
via pivot to this by sum or max + tabular format + repeat item labels + off all grand totals + rename value from sum of 1 to 1 (add a space)
Copy and paste the pivot as value into a new range and add in additional column called "new seq", use the formula below for "new seq" column which references to the launch year table next to it.
=INDEX(G$2:G$4,MATCH(A2,F$2:F$4,0))+NUMBERVALUE(B2)-1
Next, just pivot the new range to get the final result.
Just change the launch year value in launch year table and refresh pivot to see the values change.

How to make an Excel line chart ignore certain cells?

I have monthly values in a column with cumulative values in the adjacent column. The cumulative calculation should only work where there is data for that month so I have used formulas such as =IF(E6>0,F5+E6,"")
I need a line chart showing the cumulative results but I don't want Excel to plot the cells containing "" Is this possible, using either chart options, or by changing the cumulative formula?
I've tried to post a picture of my chart but I'm new here so it won't allow me to. Let's see if it allows a link to mediafire instead.
In my picture (if you can see it) I want the red line for 2015 to stop at March, instead of plotting zeroes for the rest of the year.
Link to screenshot
One possible solution is to use:
=IF(E6>0,F5+E6,NA())
It will display #N/A instead of empty string. If it doesn't look OK, you could create a helper column with this formula, add it to chart, and hide this column.

Group data by week but display date format axis

I have data which I want to display on an Excel column chart. It represents the number of sales per week, where the date is the first day of the week:
If I leave the dates as dates then Excel interprets this as data for one day out of seven, so I get thin columns with large gaps:
I can resolve this by formatting the dates as text, which gives me the style I want:
However, I want a date scale where only the first of each month is labelled, which I think requires a date formatted axis.
Basically, I want to achieve this in Excel instead of paint:
Any ideas on how (if) this can be done?
What you could do is make a line chart on the date axis, add and format error bars, then hide the lines and markers. Use the Minus option for the error bars, with no End Caps, and a Percentage Value of 100%, so the error bar reaches the horizontal axis. Format the error bar lines to simulate a thicker bar.
I had to do this recently and the way I got around it was to create a second set of values using the =Text(A1,"MMM YY") formula.
Instructions on your actual sample data:
Insert a column between Week beginning and Sales (For the purpose of this we will assume Week beginning is in column A)
In the new column B row 2 enter this formula:
=IF(TEXT(A2,"MMM YY")<>TEXT(A1,"MMM YY"),TEXT(A2,"MMM YY"),"")
Here we are telling it only to list if it is the first instance of the new month
Copy it down as far as column A has data
Highlight the data in column B and C
Create a column chart
Your chart will now look how you wanted it
Edit: I just noticed you have "Week beginning" but I assume you want your chart to be week ending for the titles?
If so then make the B2 formula
=TEXT(A2+5,"MMM YY")
and then make the B3 one
=IF(TEXT(A3+4,"MMM YY")<>TEXT(A2+4,"MMM YY"),TEXT(A3+4,"MMM YY"),"")
And drag down, I have added 4 on the assumption your week closes on Friday (Monday + 4 Days) but you can adjust that accordingly

Excel Line Graph - Putting 2 rdifferent Variables on X Axis from table

I'm having trouble putting data on 2 different types of data on my x-axis from the data in my table. How can I get the month and year data from my table to a line graph like this?
Like in the graph shown, I want all to group the x-axis by year range (2001-2002, 2002-2003, etc). And then within each year range, I want the values for each month to show for that year from August to May. And repeat this again for each year interval.
What should I select on select data source to make it look like the graph shown?
In Excel, you can arrange your data this way (I've only included 3 years):
Every cell that seems blank is really blank, that is, it doesn't contain a formula or a space or anything that doesn't appear. The "XXX" in the second cell of the second column is temporary. Create your line chart with this data, then delete the "XXX" and format the chart.
Recommend combining the month and year dimensions into a single month-year column and making the values line up in a single column. Then put month-year on the x axis and values on the y axis.

Resources