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
Anonymous
Not applicable

CALCULATE DISTINCT value in a measure in DAX

Hello,

I have a measure that returns the number of distinct visitors from a column for each zone (or all zones depending on the applied filter). The thing is, I have to apply a ratio to that value (before it is returned), depending on the zone. But as long as a measure cannot determine a unique value from a column, I have no idea how to use that ratio.

For example, I have 3 zones in wich I want to measure the number of distinct visitors for each while appliying the ratio depending on the zone ( 100 people * 1.2 for the first zone, 250 people * 1 in the second and 325 * 0.6 in the last) and then I want to make a sum of those numbers or something.

nb_devices = 

var nb = CALCULATE(DISTINCTCOUNT(meraki_observation_zone[client_mac]))

// ratio = CALCULATE(DISTINCT(zone_ratio[ratio]);FILTER(zone_ratio; zone_ratio[zone]=meraki_observation_zone[zone]))
// nb2 = nb * ratio

return IF( ISNUMBER(nb) ; nb ; 0 )

 

Thanks in advance! 

17 REPLIES 17

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.