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

Can't figure out this simple DAX issue

I have what I believe is a simple issue to fix, I assume a MIN function is needed, but can't get the syntax right. I have a simple data set here, with fundraisers who can have multiple prospects, and the prospects are ranked. A prospect can be ranked by more than one fundraiser - which is the essense of my problem:

 

If a prospect is ranked differently by more than one fundraiser, then we want the prospect to be counted with the rating given by that fundraiser. But if we don't filter for fundraiser and show all, then we only want each prospect counted once, and we want to take the MIN(rank) for that prospect.

 

For example, I have this data:

pozzyal_1-1609946881571.png

If I filter my dashboard for fundraiser f4, I see the correct data, 1 item for ranks 1 and 2 (best/better):

pozzyal_2-1609946962161.png

 

But if I remove the filter to show all fundraisers, I get a total of 8 items, representing the 8 rows in my data. 

pozzyal_3-1609947036817.png

This isn't what I want, as I'm double-counting prospects 4 and 6. What I want is to aggregate the data so that I only get one row per prospect, and I use the min rank value. In this sample, I've added an extra "rating_all" column to show the value which should be used when we're showing all fundraisers. However, I don't think I want or need that column, all I really need is to always show the min value per prospect, and that may change depending on whether or not fundraiser is being filtered.

pozzyal_4-1609947205085.png

 

So this is what the chart should look like with no fundraiser being filtered:

pozzyal_5-1609947257722.png

 

The .pbix and data can be found here

 

Thanks!

 

 

3 REPLIES 3
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

What's your expected output? As I can see duplicate prospects for 4 and 6 ,but they belong to different fundraiser. Do you want to remove the duplicate value for prospects by use MIN function? You can use the following measure :

 

MINX(ALLEXECPT(fact,fact[prospect]),fact[rank])

 

But the slicer for fundraiser will not work well any more. So would you please explain more about what's your expected output? 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@Anonymous , Try distinctcount

distinctcount(Table[fundraiser])

Anonymous
Not applicable

I'm using distinct count, but I still have two rows in my data for a couple of the prospects, because they have different ratings:

pozzyal_0-1609948832729.png

For prospects 4 and 6, I need to show the min(rating) so that each is only counted once. But when I tried to create a measure usig MIN, I end up getting "1" as the value for everything, as it seems to be looking at the entire dataset to get MIN, rather than doing it per prospect. Does that make sense?

 

 

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.