I'm trying to overlay three different columns in one chart on Power BI Desktop.
To try to show a comparison of the number of orders per month by different years I have one column for Order Number, and three other columns for Sale Date; Sale Date 2016, Sale Date 2017 and Sale Date 2018. For each order number the three Sale Date columns have a number from 1-12 (representing the month in that year that the order occurred) or a null value (if the order occurred in another year). Something like this:
I'm trying to overlay the three Sale Date columns as individual lines on a line chart with Order Number (Count Distinct) as one axis and Sale Date 1-12 as the other axis. I would think that this would be comparatively simple but Power BI Desktop doesn't seem to have an option to set this up. I'd be open to other types of chart too, as long as the different years can be easily compared.
The reason you're having trouble is that your data is not shaped in a way that is conducive to the way Power BI works.
I'd recommend unpivoting your Sale 201x columns in the Query Editor before trying to do anything. When you do this, your data will look like this instead.
Order # | Year | Month
--------|-----------|------
101 | Sale 2016 | 6
102 | Sale 2017 | 8
103 | Sale 2018 | 12
104 | |
When it's in this format you can use it in a visual much more easily using Order # on your axis and Month for values while using Year as your legend.
Related
Hello Stack Overflow Community,
In the attached excel sheet image, there are 5 columns (cols B to F) that have arbitrary sales numbers for years 2016-2020. In the report there will be a year slicer of each of these years. I want to calculate the total sales depending on the selection in the year slicer. However, there are 15 columns towards the end which dictate whether a particular company should be included in the total sales calculation. Only if the column corresponding to the selection by the user is N, the value should be included in the total sales calculation.
Example: If the user selects 2016,2017 and 2018 in the year slicer, Power BI should look into the column Excluded 2016-2017-2018 and include/ exclude the sales numbers of the respective years and finally return a table as below
Year Sales (Total)
2016 393
2017 561
2018 580
There is two problem in your case : the first is to be able to calcule with the filter and I think it will be easier if you do this in Excel and the second problem is to use a filter on a combinaison of imput to select only one value.
For the fist problem you could probably do something like that :
=IF(H2="Y";F2;0) / =IF(I2="Y";G2;0) / =IF(J2="Y";G2+F2;0)
and use the power of excel to slide the formula to the bottom of your table
And the next step is to sum the entire column and pivot the table :
But for the selection of the right row with your slicer on date i can't find a solution maybe you need to build a slider for all combinaison : 2016 / 2017 and 2016-2017,...
I have a table visualisation that shows some data. I would like to filter the data so that only data entered the previous working day is shown.
So if the data is refreshed on a Tuesday, then only Monday's data is shown, if on Thursday then only Wednesday data and finally if its refreshed on a Monday, then only Friday's data is shown.
At the moment i can only apply a filter on Power BI desktop for the previous day, which is including weekends (data in the last 1 day)
The data is a simple two column visualisation. In the example below, 17th January is a Friday, so that is the only comment i would like to see on Monday (20th Jan). On the 22nd of January, the only comment i would like to see is the one entered on 21st January:
+-------------+---------------------+
| Date | Comment |
+-------------+---------------------+
| 17-Jan-2020 | Defrosting required |
+-------------+---------------------+
| 20-Jan-2020 | Pallet area cleaned |
+-------------+---------------------+
| 21-Jan-2020 | Workshop not locked |
+-------------+---------------------+
What formula can i use for this please?
Here is what I did.
Data I have is as below
Then I added a new column IsWeekday which will give me True false for weekday with expression
IsWeekday = If( (WEEKDAY(POC[Date Entered]) <> 1 && WEEKDAY(POC[Date Entered]) <>7); "True";"False")
Now my Entire table looks like below
Now we add filters to Table as below
IsWeekday with only True
Then we add Filter for Field Date Entered as Relative date filtering as
is in last days 3 (why 3: because if we are on monday, we want last (sun,sat,friday)
does not include today.
Now add one more filter Date Entered
(Note: you are adding Date Entered twice)
one for last 3 days and one for Top N (1) and by value with Latest date Entered
Why one more date Entered: Because if we are on 31-Jan-2020 i.e Thursday,
Our first filter will give us
Mon,tue,wed,thur,fri
Now our second filter will give us
28-jan,29-jan,30-jan
But we want only 30-jan For (considering 31-jan is today's date)
so last filter will come in play and you will have your desired result.
Let me know if this helps.
I'm trying to display a vintage analysis line chart in Power BI. I have replicated the chart in Excel from an output of an SQL query.
Each month 0,1,..,12 is the month relative from the business date row representing +1 months from , +2 Months from ... etc.
The issue I'm having is that this dataset doesn't work in Power BI. What does the base data have to look like in order to achieve the line chart as seen in the picture?
The data I have in Power Bi is structured thusly:
[orig] | [0] | 1 | 2 | ... | [12] | [Date]
where orig .. [12] are aggregate columns (counts) for each Date in a cumulative fashion. i.e [n] = Cts + [n-1]. This data is prepared in SQL. Power Bi does no aggregation.
Each date is supposed to be it's own line from 1 - twelve (x axis) with the values being the cumulative totals as described above.
I have made some progress on the chart... looks to be good. except it's backwards...
I have tried creating a sorting column, but get the error message that
FIXED IT!!!!! simple solution. sort ascending on the chart.
But, now, how do I stop PowerBI from displaying a flat line? Below is an example using EXCEL of what the chart should like.
In Power BI the series need to be in columns, so you need to transpose the table and make the dates the column headings. Add a column for the months numbers as text, not numbers, so it can go on the axis.
Try using three columns. One for the date, one for the Category (0,1,2,etc.), and one for the percentage. You can accomplish this by using unpivot in the Power Query window.
I'm using Power BI, pulling data from a SQL server, but for a column containing date, it keeps splitting into 4 other columns when I try and show it in a table:
Year | Quarter | Month | Day
Has anyone had this issue before?
Note: Under modeling, when selecting that field I did try placing Data Type as Date. No change.
This is because Power BI made a date hierarchy from this field. If you do not want this, right click it in the designer and uncheck Date hierarchy from the menu:
I am creating a Month table to be included in my Power Bi Dashboard as a Filter.
I create a separate table joined to main table, but unable to select the option from the menu to Sort By Column- Greyed out.
What am I missing. I just want a filter of Months (Jan, Feb, Mar, etc) in numeric order. Can someone direct me to a good how to?
If a sort has already been specified, it will be greyed out.
Click on the Data icon in the upper left.
Click on the column that may have a sort on it.
Click Clear Sort.
Click on another column, then click back to the column you want to sort.
Sort By Column will no longer be greyed out.
When you create Report using Power bi data set (not connect directly to database) you cant use column sort it will appear disabled
Appending numbers to the beginning of your linked Month table might help you issue.
If your data looks something like this..
Revenue by month ID
Month table
Then make sure your month table is formtted like so in PBI
You can then filter like so
Alternatively, you could format the sorting month column to text and filter like so:
There's a cleaner way to do this. It's demonstrated starting at about 10:50 in this video.
https://youtu.be/d2bZpNZ6uIA?t=10m50s
You'll need to have a column of number values that correspond to the text values and then tell Power BI to sort by the number column. You can add such a column with "Enter Data" if it doesn't exist.
The preferred way to do this is to use a sort by column that looks like this:
Month | MonthSort
Jan | 1
Feb | 2
Mar | 3
Apr | 4
May | 5
Jun | 6
Jul | 7
Aug | 8
Sep | 9
Oct | 10
Nov | 11
Dec | 12
Then on the modeling tab, select the Month column. Then click the Sort By Column button in the ribbon and select MonthSort.
https://learn.microsoft.com/en-us/power-bi/desktop-sort-by-column#sort-using-the-sort-by-column-button
This is an old post, however, I was not able to solve based on above answers. So updating based on what helped me.
In Power query editor, create a new column in the same table as month number for corresponding month. Apply the changes and return to report screen.
In report screen, select the field "Month", go to modelling and click sort by "Month Number". Note:- this makes Month to be sorted based on Month number rather than alphabetical.