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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.