Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply

How to use distinct and get the unique values in created measure (expression) by account name?

Hi Experts ,

I am stuck with the scenario below :

Recently i have applied unpivot columns for few columns to rearrange the rows & attributes.

After that most of the columns are duplicated (expected) , I have fixed few values related to that columns by using DISTINCT dax , but I cannot use the same DISTINCT into the measure which i have created to summing up the values and with using some other measures as below :

Revenue & Margin = SUMX('Delivery Updates',[Revenue*Margin]) --> [Revenue*Margin] is an another measure which result is OK.
The result should be : 51246 euro (1 Account)
But once i did unpivot columns 1 row of account was duplicated as 27 rows with same account name as below :
 
before unpivot :
dinesharivalaga_0-1722433928846.png

after unpivot : (27 rows)

dinesharivalaga_1-1722433962269.png

Now the case is I cannot use DISTINCT to get the 1 Account value from this measure.

Now it is showing below huge number : total 27 rows = 27*51246

dinesharivalaga_2-1722434051305.png
Please help to fix this part asap 😞
Due to this the total margin% is impacted ..
 
Thanks
DK
1 ACCEPTED SOLUTION
v-zhangtin-msft
Community Support
Community Support

Hi, @dinesharivalaga 

 

As an example, does your sample data look like this?

vzhangtinmsft_0-1722490629432.png

Maybe you can try this formula.

Measure = 
 VAR _table=DISTINCT('Table')
 RETURN
 SUMX(_table,[Value])

vzhangtinmsft_1-1722490685543.png

Is this the result you expected?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-zhangtin-msft
Community Support
Community Support

Hi, @dinesharivalaga 

 

As an example, does your sample data look like this?

vzhangtinmsft_0-1722490629432.png

Maybe you can try this formula.

Measure = 
 VAR _table=DISTINCT('Table')
 RETURN
 SUMX(_table,[Value])

vzhangtinmsft_1-1722490685543.png

Is this the result you expected?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.