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
allenpee85
Helper I
Helper I

Create Measured for Unique Customer Number by Product

Hi all, need help.

 

How can I make an Indicator (Expected Result) based on unique Customer Number and Type of property.

 

E.g. Each unique customer number will be group by property type, customer 111 having Shop and Bungalow, this is not expected result, because it consist both types of property.

But only unique Customer Number with only Shop property type will be taken.

 

What is the Power BI measures can use here?

 

Thank you.

 

IMG_20220324_102109.jpg

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=if(calculate(distinctcount(Data[Type]),filter(Data,[Data[Customer Number]=earlier(Data[Customer Number])))=1,"Yes","No")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 

 

Have tried to paste the formula, seems there is error, could help to fix?

Thanks.

 

Capture.PNG

The brackets are incorrectly placed.  Check my earlier reply.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur ,

 

Sorry to bother you again, copy and paste the formula provided....

 

=if(calculate(distinctcount(Data[Type]),filter(Data,[Data[Customer Number]=earlier(Data[Customer Number])))=1,"Yes","No")

 

The results as below....

Capture.PNG

 

Can help to relook which part did i miss?

 

Thank you for your kind assistance.

Remove [ before Data


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@allenpee85 , A measure

 

=

var _1 = countx(filter(allselected(Table) , Table[Customer] =max(Table[Customer]) ) , Table[Customer])
return
if(_1=1, "Yes", "No")

 

 

or a new column

 

new column =

var _1 = countx(filter((Table) , Table[Customer] =earlier(Table[Customer]) ) , Table[Customer])
return
if(_1=1, "Yes", "No")

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak ,

 

Thanks for your kind assistance, tried the formula and it works.

 

var _1 = countx(filter(allselected(Table) , Table[Customer] =max(Table[Customer]) ) , Table[Customer])
return
if(_1=1, "Yes", "No")

 

tempsnip.png

Can i trouble you to help add a condition to indicate "YES" only for Customer Number 444 - with "Shop" property?

Rest of type e.g. Terrace, Bungalow still shows "No".

 

Thank you in advance.

 

Hi @amitchandak 

 

Have also tried your formula, but a bit error... could you help me to see the formula again?

Wanted to upload the PBI file, but cannot....

Many thanks!

 

var _1 = countx(filter(allselected(Table) , Table[Customer] =max(Table[Customer]) ) , Table[Customer])
return
if(_1=1, "Yes", "No")

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.