I have a table visualisation I am building with a column of names. Now if the column has a name then it should be sorted A-Z, and if it is blank, then should be at the bottom of the table. Anytime I sort currently, the spaces are at the top of the table, followed by A-Z sorting. Any idea on how to solve this in Power BI?
You will need a helper column for the sort order, because Power BI sorts blank before text.
You could use Power Query to extract a unique list of name values from the transaction table. Add a blank cell to that table, then create an Index column to assign a sort order to that column. Add that helper table to the data model and create a relationship to the transaction table.
In the data model, set the index column of the helper table as the "Sort by" column for the names.
You can now use the name values from the helper table in visuals. When you sort by the helper table names, the sort order from the Index column will be applied.
Related
I have 2 tables, one of which includes a column of id numbers. The other table has a column with multiple occurrences of each id-number. I would like to add a column to the first table telling me how many times each id appears in the second table.
Power Bi is new to me so I have gotten nowhere so far.
If you have relationship between these two table on this ID then you can use simple measure:
CountOF = CALCULATE(countrows(detail))
I'm trying to display all of the distinct values within this table (there are many other columns in this table) and show how many rows each distinct value shows in.
I have tried to use group by but this does not work. It needs to be filterable by country from another column but i can do that by page filter.
I am trying to show what the top 5 associations are in terms of appearance.
enter image description here
Put the 10 columns in a Table visual. Then create this measure and add it too. Then sort descending on Distinct.
Distinct = COUNTROWS('Your Table Name')
To see only the Top 5, go to the Filter pane, and pick the first column and set the Filter type to Top N, and then Top 5 by the Distinct measure.
I have two tables one contains User data and other is my dates table.
Is it possible to copy each row from users table for each date from dates table like below?
It is possible using transformations:
Add custom column(column formula is second table name):
Expand column:
I'm trying to create a new column which is filled by the highest value name and condition is today date and if suppose two values are the same then we have to pick the first one value name.
My table is
My Expected table is
Condition is
select screen name has new column value from the most viewed screen by using a count value, selected customer count should be 1 group by id and start date
Best approach here would be that you add a blank query in the query editor. Make the blank query the same table as your first table.
=FirstTableName
Call the blank query SecondTable for example.
Add a filter with the current date.
Group your table by Screen, by count and by the start date. (I think you need a count value that the grouping will work)
Add a sort order for the column count (descanding).
Delete all rows expect the first row.
The result is now one row with the highest value in the count column on todays date.
Join this one row now with your first table. The column screen and the start date are the join columns and expand the screen column from your joined table.
This gives you the result like your second picture.
I would like to create a table to compare Month To Date (MTD) Vs YTD Sales data metrics
I am using two queries:
1st query = YTD Sales data (Two fields: Sales and Quotes)
2nd query = MTD Sales Data (Two Fields: Sales and Quotes).
Each query has the same field names, just different data
I would like to output a table like the following
How to I create the above table? At the moment I can only create a table like the following:
The latter 1x4 table only works if I appropriately name the fields. But definitely isn’t what I want, because with enough fields, the table could go on forever.
Any help would be appreciated
In the query editor, create a label column for each table that labels what they are and then append the two tables together so you get something like this:
Then you can create a matrix visual with the Label column in the Columns field and the Sales and Quantity columns in the Values area.
Make sure you've switched "Show on Rows" to "On" under the Format > Values section of the Visualizations pane.