尝试在 Power BI 的数据视图中重新排序列 [英] Trying to Reorder Columns in Data View in Power BI

查看:34
本文介绍了尝试在 Power BI 的数据视图中重新排序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以在 Power BI 的数据视图"中重新排序列?我首先尝试在 Power Query 中执行此操作,但是当数据加载到表中时,列会自动重新排列.

Is there a way I can reorder columns in 'Data View' within Power BI? I tried doing it in Power Query first but when the data loads into the table, the columns automatically rearrange.

推荐答案

评论后编辑.就像在 Power Query 中一样,可以轻松地强制执行列顺序:

Edit after comment. There is easy fix to enforce column order just as in Power Query:

  1. 在 Power Query 编辑器中 >禁用查询加载.关闭并申请.
  2. 再次打开查询编辑器,启用查询加载.刷新查询.然后关闭并申请.


回答被误解的问题.


Answer to misunderstood question.

这可能是 M PowerQuery 中有趣的解决方案.下面的函数允许您通过仅说明整组列中的几列来对列进行重新排序.将此添加到空白查询中并将其重命名为 FnReorderColumnsSubset.

This may be interesting solution in M PowerQuery. The function below let you reorder columns by only stating few columns from the whole set of columns. Add this in blank query and rename it to FnReorderColumnsSubset.

(tbl as table, reorderedColumns as list, offset as number) as table =>
    Table.ReorderColumns
    (
        tbl,
        List.InsertRange
        (
            List.Difference
            (
                Table.ColumnNames(tbl),
                reorderedColumns
            ),
            offset,
            reorderedColumns
        )
    )

像这样使用它:

= FnReorderColumnsSubset( Source, { "Region", "RegionManager", "HeadCount" }, 0 )

在这里找到它:https://datachant.com/2017/01/18/power-bi-pitfall-4/

这篇关于尝试在 Power BI 的数据视图中重新排序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆