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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
susheeltyagi
Helper I
Helper I

How get the Count of Unique recors of one field on the bases of Other uniue field.

HI,

 

I need the expert help. I am trying to find the formula for count of Unique record of one field (Firmware) on the bases of different field (Serial number).


I was using the below formula but the number of Firmware its not uniuqe :

FirmwareCount = CALCULATE(COUNT(DeviceQuery[Firmware]))

 

Example  :

DeviceID              Firmware

Device 1              ABC

Device 2              ABC

Device 3              ABC

Device 4              ZXCD

Device 5              ZXCD

Device 6              NMS

 

 

Expected Output :

Firmware      Count

   ABC                   3

   ZXCD                 2

   NMS                  1

 

My device table as below :

 

Table   : DeviceQuery

 

susheeltyagi_0-1622111145901.png

 

Expected Output :

 

  Expected Output should have Unique Number of Firmware from all the devices

 

susheeltyagi_0-1622111206653.png

 

 

Thanks

 

Susheel

 

 

 

1 ACCEPTED SOLUTION
Tahreem24
Super User
Super User

@susheeltyagi  Try this measure:

FirmwareCount = CALCULATE(DISTINCTCOUNT(DeviceQuery[Firmware]),ALLEXCEPT(DeviceQuery[SerialNumber]))

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

View solution in original post

6 REPLIES 6
Tahreem24
Super User
Super User

@susheeltyagi  Try this measure:

FirmwareCount = CALCULATE(DISTINCTCOUNT(DeviceQuery[Firmware]),ALLEXCEPT(DeviceQuery[SerialNumber]))

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

I got solve as by Creating new table as:
UniqueDeviceTable = ALL ( DeviceQuery[SerialNumber],DeviceQuery[Firmware] )

 

Create New Measure

FW Count = COUNTROWS (UniqueDeviceTable)

susheeltyagi_2-1622118865774.png
amitchandak
Super User
Super User

@susheeltyagi , Try a measure like

Distinctcount( DeviceQuery[SerialNumber])

Dear Friend,

 

Thanks for the idea

 

I have created the new table from the main Device Table

 

UniqueDeviceTable = ALL ( DeviceQuery[SerialNumber] , DeviceQuery[Firmware] )

susheeltyagi_0-1622115513509.png

Then I create the new Measure in it as below :

UniqueFW = Distinctcount( UniqueDeviceTable[Firmware])

also try with
FwCount = CALCULATE(DISTINCTCOUNT(UniqueDeviceTable[Firmware]),ALLEXCEPT(UniqueDeviceTable, UniqueDeviceTable[SerialNumber]))

 

In both the case I am getting the wrng Firmware count

 

susheeltyagi_4-1622116214063.png

 

 

The Expected Output should be as below:

susheeltyagi_2-1622115985190.png

Please help me for the distinct FW count

 

 

 

 

But I need the count of unique  Firmware on the bases of Unique SerialNumber.

 

How to implement in one formula ?

Anonymous
Not applicable

concatenate these two columns in a calculated columns and the use a countdistinct of this column as a measure.

Hope it helps

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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