汇总Power BI中首次出现的不同值 [英] Sum distinct values for first occurance in Power BI

查看:580
本文介绍了汇总Power BI中首次出现的不同值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Power BI中,我的数据中有一些重复的条目,只有1列不同,这是一个详细信息列。

In Power BI I have some duplicate entries in my data that only have 1 column that is different, this is a "details" column.

Name   | Value | Details
Item 1 | 10    | Feature 1
Item 1 | 10    | Feature 2
Item 2 | 15    | Feature 1
Item 3 | 7     | Feature 1
Item 3 | 7     | Feature 2
Item 3 | 7     | Feature 3

我意识到这是数据结构的问题,但不能更改。

I realize this is an issue with the data structure, but it cannot be changed.

基本上,当我对Power BI卡上的值列求和时,我只希望对每个唯一名称求和,因此在这种情况下:

Basically, when I sum up my Value column on a Power BI card, I only want it to sum for each unique name, so in this case:

Total = 10 + 15 + 7 

我将在矩阵中使用详细信息,所以我不能简单地从查询编辑器中删除重复项。

I will be using the details in a matrix, so I cannot simply remove the duplicates from within the Query Editor.

有什么方法可以过滤此内容使用DAX公式?

Is there any way I can filter this with a DAX formula? Just summing the first occurrence of an item?

推荐答案

您可以按以下步骤创建度量:

You can create a measure as follows:

Total = SUMX(DISTINCT(Data[Name]), FIRSTNONBLANK(Data[Value], 0))

它将为所有不同的 Name <返回第一个非空白的 Value / code>并对其求和。

It will return the first non-blank Value for all distinct Name and sum it up.

结果:

这篇关于汇总Power BI中首次出现的不同值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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