In PowerBI I have the categorical values 'Small', 'Medium' and 'Large' and I have these on my x-axis. I want them to be in the order above but they appear sorted alphabetically. Can I define an order for categoricals (as I can in R using factors)?
Yes, you can use the Sort by column feature.
Related
I'm trying to create a calculated column based on a derived measure in SSAS cube, this measure which will count the number of cases per order so for one order if it has 3 cases it will have the value 3.
Now I'm trying to create a bucket attribute which says 1caseOrder,2caseOrder,3caseOrder,3+caseOrder. I tried the below one
IF([nrofcase] = 1, "nrofcase[1]", IF([nrofcase] = 2, "nrofcase[2]",
IF([nrofcase] = 3, "nrofcase[3]", "nrofcase[>3]") )
But it doesn't work as expected, when the level of the report is changed from qtr to week it was suppose to recalculate on different level.
Please let me know if it case work.
Calculated columns are static. When the column is added and when the table is processed, the value is calculated and stored. The only way for the value to change is to reprocess the model. If the formula refers to a DAX measure, it will use the measure without any of the context from the report (eg. no row filters or slicers, etc.).
Think of it this way:
Calculated column is a fact about a row that doesn't change. It is known just by looking at a single row. An example of this is Cost = [Quantity] * [Unit Price]. Cost never changes and is known by looking at the Quantity and Unit Price columns. It doesn't matter what filters or context are in the report. Cost doesn't change.
A measure is a fact about a table. You have to look at multiple rows to calculate its value. An example is Total Cost = SUM(Sales[Cost]). You want this value to change depending on the context of time, region, product, etc., so it's value is not stored but calculated dynamically in the report.
It sounds like for your data, there are multiple rows that tell you the number of cases per order, so this is a measure. Use a measure instead of a calculated column.
I have Power BI report having some filters implemented on columns. Now I have to add a new filter on the basis of measure, I have data in the following format for that column, +ve integer, -ve integer or 0.
What I'm trying to achieve, there should be a filter with three default values (+ve integers, -ve integers and 0).
When I select +ve, it should show only records having +ve integer values and so on for two other cases.
Problem: I am creating measure from a measure but not getting the exact data from it.
The second thing I did was created a measure of positive and negative, I am getting the exact data if I will use in table visual but not in the slicers form.
Measures are not meant to be used as slicers. A best practice for Power BI is that if you need to filter by a certain criteria then you should create a new column in the data to reflect which values you want to filter by.
If you have a very large data set then I would do this in the Query Editor using a conditional column.
If you size isn't a factor then make a calculated column like so,
Answer =
SWITCH (
TRUE (),
'Table'[Values] > 0, "Postive",
'Table'[Values] < 0, "Negative",
"Zero"
)
Now insert the column into the filter and you should be able to easily switch between what you need.
I'm using Lucene.Net to index and search. My data contains some numeric fields.
How can I sort search result by sum/multiplying of mulitple numeric fields?
The simplest solution is to index an extra field with the calculated value then sort by that.
This is a very common technique in "no-sql" stores. ie denormalise and store whatever extra values are needed to optimise query time performance/capabilities.
I have a table with three different columns: FaultLevel1, FaultLevel2 and Quantity. This columns are extracted after filtering parameters from other columns, but graph uses these three columns.
So, the graph looks like a waterfall graph (Range Column graph), and in
Category Groups: FaultLevel1;
Series Groups: FaultLevel2;
Values:Sum(Quantity).
Basically, the issue is in sorting, because first I need to sort by FL1 (quantity), and then by FL2 (quantity). But when it generates, it looks like a waterfall, but the FL2 values with high to low come after each other, whereas, it should come in such an order that all quantities of FL2 on each FL1.
So, the question is how can I put sorting for FL2, that is sorts on Sum(Quantity) of FL1, not quantity of FL2.
In SSRS, the chart has same structure as matrix instead of table.
Category: Row Group
Series: Column Group
Values: Value
If your data are just the three columns in a table, they are under same level. You should not make data in tabilx without column group rendered in a chart with series. Otherwise, it will look like a waterfall as your scenario.
I have a dataset where numeric variable VARSORT takes only 3 values: 10, 20 and 30 (there are no missings).
I would like to sort observations based on VARSORT but where the custom sort order would be the following : 20 first, then 10, then 30.
Is it possible to do that?
You just need to sort on a variable with the desired order, which could be, among many other solutions,
gen varsort2 = cond(varsort == 20, -10, varsort)
There is no option to specify a custom order without specifying a variable. Clearly Stata has the idea that a dataset may be sorted by one or more variables. If that's so, then keeping track of such variables is crucial to Stata noting whether a dataset has changed (which includes a change in the sort order). That mechanism could not work in the same way if a variable or variables were not used to indicate sort order.