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
sthomas38
Frequent Visitor

DAX measure calculation based on two different measures

Hi Experts,

I have an issue. 

Dataset A has a measure called distinct counts of ID by different networks. And a rank measure to show which has the highestr to lowest.

Dataset A has thousands of rows by Network and ID and geographical regions (State, County, City, Zip etc.)

NetworkCountRank 
ABC1234
BCD2502
CDF231

3

DFG333

1

 

Dataset B has thousands of rows for JUST Network BCD and IDs again by georgraphical regions.

So say, BCD has a count of 350 NOW.

 

I need to calculate new rank, with all networks from Dataset A but only for Network BCD, I need to get the counts from Dataset B. 

How should that measure be? What is the DAX? This DAX should also be filterable by geographic regions. 

Please can someone help me?

Thank you.

 

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @sthomas38 ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create measures. 

new count = 
VAR _BCD=CALCULATE([count_b_measure],FILTER(ALL('Dataset B'),[Network]="BCD"))
RETURN IF(MAX('Dataset A'[Network])="BCD",_BCD,[count_a_measure])
new rank = RANKX(ADDCOLUMNS(ALLSELECTED('Dataset A'),"new count",[new count]),[new count],,DESC,Dense) 

(2) Then the result is as follows.

vtangjiemsft_0-1713836104169.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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-tangjie-msft
Community Support
Community Support

Hi @sthomas38 ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create measures. 

new count = 
VAR _BCD=CALCULATE([count_b_measure],FILTER(ALL('Dataset B'),[Network]="BCD"))
RETURN IF(MAX('Dataset A'[Network])="BCD",_BCD,[count_a_measure])
new rank = RANKX(ADDCOLUMNS(ALLSELECTED('Dataset A'),"new count",[new count]),[new count],,DESC,Dense) 

(2) Then the result is as follows.

vtangjiemsft_0-1713836104169.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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!

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.