问题描述
我有下面的图表
按每个 bin 的计数排序.我尝试按从 0 - 5 天、5 - 10 天等开始的开放天数对其进行排序...
that is sorted by the count for each of the bins. I try to sort it by days open starting from 0 - 5 days, 5 - 10 days etc...
我添加了另一个表,其中包含每个箱子的 ID(0 - 5 天为 1,5 - 10 天为 2),但我无法使用它对其进行排序.
I have added another table that has IDs for each of the bins (0 - 5 days is 1, 5 - 10 days is 2) but I am unable to use it to sort it.
有什么想法吗?
推荐答案
我总是通过添加维度表来进行排序.垃圾箱的暗表如下所示:
I do it always by adding dimension table for sorting purpose. Dim table for bins would look like this:
然后转到数据窗格并如下图所示进行设置.
Then go to Data pane and set it up as shown in the picture below.
- 选择
Bin name
列 - 从菜单中选择
建模
按列排序
,这里选择列Bin order
- Select
Bin name
column - Choose
Modeling
from menu Sort by column
and here choose columnBin order
然后将 Dim 表连接到事实表:
Then connect the Dim table to fact table:
在制作视觉时,从 Dim Table 而不是 Fact Table 中选择 Bin name
!
While making visual choose Bin name
from Dim Table not Fact Table!
然后最后的事情是在视觉上设置排序:
Then the final thing is set up sorting in visual:
这里有 Dim 和 Fact 表来重现锻炼.
Here you have Dim and Fact table to reproduce exercise.
暗表:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcsrMUzDQNVXSUTJUitWB8E11DQ2AAkZwAUMDXSOQiDFcxAioByRigtBkoGsIVmSK0GZkoA0UMFOKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Bin name" = _t, #"Bin order" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Bin name", type text}, {"Bin order", Int64.Type}})
in
#"Changed Type"
事实表:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jdAxDoAgDAXQq5iu0qQtVmX1GoQDuHj/0SoJCWVh5KefR8kZrvtZCBUCMJRQz4pMFkgLmFC+ZGuJWKefUUL+h6zbekJrd3OV1EvHhBSnJHLU6ak0QaWRil5SBw2/pwPEMzvtHrLnlRc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Bin name" = _t, Frequency = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Bin name", type text}, {"Frequency", Int64.Type}})
in
#"Changed Type"
这篇关于Power BI - 堆栈图表排序依据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!