I am unpivoting few columns which are extracted from a Date field, to show as a radio button in the slicer.(fields are: "Daily", "Yearly", "monthly", "quarterly")
Qs.1: Can I show these values in a custom order like: "yearly", "quarterly", "monthly", "Daily"
Data format( I have used the "Attribute" column in the slicer to achieve the radio buttons)
Qs.2: To sort the x-axis I have used the main date field("app_submitted_date) on the tooltip.
If I don't use the "app_submitted_date" on tooltip will not be able to sort x-axis when "quarterly" & "monthly" is chosen.
While using the "app_submitted_date" filed on tooltip I am getting the tooltip in the following format:
How to customize the tooltip so that it will only show ( Female: count, Male: Count, Not Disclosed: count, Date: whatever date it is)
Please let me know for any clarification in the question.
Qs-1 Solution
Create a small table with two columns & 4 rows :
Attribute Names
Index
as follows :
| Year | 1 |
| Quater | 2 |
| Month | 3 |
| Daily | 4 |
Then, create a 1 to many relation between this table and the table that you showed in the question (Attribute to Attribute connect).
Then, instead of take the contents of this attribute column as a filter and prior to that sort this attribute column by index in the "Table View".
Qs-2 Solution
For this solution, I agree with the answer provided by Jon. There is no way to hide the thing that you have taken in tool tip; as of now.
Formatting the tool tip directly as you have suggested cannot be done, however there is a work around with 'Tool Tip' pages, that may help you show what you need.
You create a new page, with the measures in, this is then displayed as a tooltip over your data. Image taken from the MS Docs website
Related
I'm struggling to create a Measure that sums a column and have it filter out duplicate IDs while taking only the latest row.
For example, there is a table as such:
UID | Quantity | Status | StatusDate
aaa | 3 | Shipped | 11/1/2020
aaa | 3 | Delivered | 11/5/2020
bbb | 5 | Ordered | 10/29/2020
ccc | 8 | Shipped | 11/4/2020
So the idea would be to sum the quantity, but I would only want to count quantity for id "aaa" once and only count towards the latest status ("Delivered" in this case). I would make a visual that shows the quantities with status as its axis. I also need to add a date Slicer so I could go back in time. So, when I go before 11/5/2020, instead of "Delivered," it would switch back to "Shipped."
I tried several methods:
SUMMARIZE to a table filtering "MAX" date value if UID is the same. I found this doesn't work with the date slicer since it seems like it is not actually recalculating the filtering and just slicing away rows outside of the dates. Seems to be the same whether the SUMMARIZE is set as a new table or VAR in the Measure.
CALCULATE seems promising but I can't seem to figure out a syntax
that filters that I need. Example of one that doesn't work (I also tried SUMX instead of SUM but that doesn't work either):
CALCULATE(
SUM(Table1[Quantity]),
FILTER(Table1, [StatusDate]=MAXX(FILTER(Table1,[UID]=EARLIER([UID])),[StatusDate])
)
I also tried adding a column that states whether if the row is "old" as well as a numerical "rank" to the different statuses. But once again, I run into the issue where the date slicer is not exactly filtering to recalculate those columns. For example, if the date slicer is set to 11/3/2020, it should add "3" to "Shipped" instead of "Delivered." But instead of that, it just removes the row which tells me that it is not actually recalculating the columns (like #1).
Any help would be appreciated :-) Thank you!
You can try something like this:
Measure =
VAR d = LASTDATE(Table1[StatusDate])
VAR tb = SUMMARIZE(FILTER(Table1, Table1[StatusDate] <= d),
Table1[UID],
"last", LASTDATE(Table1[StatusDate]))
RETURN CALCULATE(SUM(Table1[Quantity]), TREATAS(tb, Table1[UID], Table1[StatusDate]))
The tb variable contains a table which has the latest date per UID. You then use that to filter your main table with the TREATAS function.
One other alternative is to create a table with the RANK function ordered by date and then doing a SUM over that table, where Rank = 1.
I am using a Matrix in PowerBI to show the Sales Manager and Sales Reps down the rows, and the different ship method and source of the order across the columns and a count of unique orders in the values.
Below shows the table structure I have, and I want to switch between "Show Values As": the original values I calculate with my measure (count of unique orders) and % of Row Total.
Currently, my only solution is to create a second table showing the different values, but I think that's a cheap solution. I've seen solutions with helper tables but since my values are a measure I cannot invoke them in other measures, and as the sources or ship methods are filtered I want the % of row total to reflect the filter as well so using a countx formula won't account for that (if I housed it in a formula).
I'm still somewhat new to the software so please bear that in mind.
Source 1 | Source 2 | Source 3
| Next Day; Ground; 2 Day | Next Day; Ground; 2 Day | Next Day; Ground; 2 Day
+Manager 1|
Rep 1 |
Rep 2 |
+Manager 2|
Rep 1 |
Rep 2 |
Looks like the best solution for you is to create bookmarks. You can create two tables, one showing the values and the other showing the %. Position the tables such that, one table is exactly on top of the other. Then create two bookmarks, one showing Table1 and the other showing Table2 (while hiding the other table using the "Selection Pane"). You can then use the bookmarks in a button action to toggle between Value and % views. The following link should give you further details on bookmarks:
https://learn.microsoft.com/en-us/power-bi/desktop-bookmarks
You can also do this by creating a measure which switches between values and %, but the formatting is going to be a pain point. I think bookmarks is your best bet.
You can create a parameter table (with no relationships to other tables in your model) to use as a slicer and a measure that switches between the two calculations based on a slicer selection.
Let's suppose you have measures [OrderCount] and [OrderCount%Total]. Then create a new table to use as a parameter ParamMeasure with a single column
Measure
-------
Count
%Total
You can now put ParamMeasure[Measure] as a slicer on your report and substitute the following measure instead of the existing ones.
OrderSwitch =
IF (
SELECTEDVALUE ( ParamMeasure[Measure] ) = "Count",
[OrderCount],
[Order%Total]
)
This way you don't need to create multiple visuals and bookmarks.
I have a table of Enter and Exit time of some people like this:
Name | EnterTime | ExitTime
=============================
Tom | 13:52:00 | 20:55:00
Robert | 15:55:00 | 21:12:00
Sarah | 19:08:00 | 19:48:00
Jack | 16:54:00 | 17:32:00
I want to show the user that in a selected point of time who has presence.
In other word, I want to have a dateTime slicer that the user will pick a time and then the table got filtered to show only rows with:
EnterTime < selectedTime < ExitTime
This can be done with a few steps.
First, we need a list of dates to go into our slicer. If you're using a separate date table, then that's a great source. Otherwise, you can build one with DAX that will contain all the dates in your EnterTime and ExitTime columns.
Click on 'Create Table' in the modeling ribbon. Put in the following DAX:
DateListTable = UNION(
SELECTCOLUMNS('MyTable', "DateList", 'MyTable'[EnterTime]),
SELECTCOLUMNS('MyTable',"DateList", 'MyTable'[ExitTime])
)
You now have a slicer and a table visual. Select the slicer and then navigate into the Format Ribbon (it's only available when the visual is selected. Use Edit Interactions to turn off the Slicer's filtering on the table. Set it to no interaction (the circle with a diagonal line through it).
Create a new measure
ShowDate =
VAR SelectedDate = SELECTEDVALUE('DateListTable'[DateList], BLANK())
Return
if(SelectedDate >= Max('MyTable'[EnterTime ]) && SelectedDate <= max('MyTable'[ExitTime]), 1, 0)
Finally, filter your table visual on the new measure, ShowDate, for when it is 1.
So, we create an independent slicer with a complete list of dates. But we break any filter relationship between it and the table. Instead, we use 'SelectedValue' to capture the value chosen from the filter, and create a dax measure that shows '1' when the value in the filter is between EnterTime and Exit time. Filter on that dax measure, and we get our desired behavior.
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.