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
RavinderSunkara
Advocate II
Advocate II

Dax measure to select only selected employee badge ids out of 500 employee information list.

Team,

 

Everyday we are doing manually to select employees required for reporting out of 500 employee list using employee badgeid. Is there a way we can write DAX measure to put only the selected 50 employeebadge ids.

9 REPLIES 9
jszlm
Employee
Employee

You can create a table with required badget id. And created a new column to identify id to show up: NeedToShow=IF(ISNA(LOOKUPVALUE(tabe1[badgetid],table1[badgetid],[badgetid])),"No","Yes").

 

Then filter NeedToShow="Yes".

We don't have access to create table in SSAS tabular cube data. We want to select random of employee badgeids from the 500 employee badge information list.

Hi! try this solution from @OwenAuger:

                 

Random Selection =
VAR SampleSize = 10
VAR TableWithRand =
    ADDCOLUMNS ( OriginalTable, "Rand", RAND () )
RETURN
    TOPN ( SampleSize, TableWithRand, [Rand] )

I tried it and it works, but you have to re-edit the table each time you want a new sample.

Hope this helps!

I found that as long as I had at least one other table created in the Query Editor (i.e. not a DAX calculated table), the Random Selection table updated on refresh.


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

@OwenAuger

 

Have you played with the SAMPLE function?

 

https://msdn.microsoft.com/en-us/library/dn306781(v=sql.110).aspx

 

"If no ordering is specified, the sample will be random, not stable, and not deterministic."


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@Phil_Seamark

Yes, I did test it out on this particular question, as it would seem an ideal function for this 🙂

 

It turns out, despite the documentation, Power BI Desktop requires the 3rd sort order argument.

And even if I set the 3rd argument to a constant, I got the same sample on Refresh.


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn
Christann
Helper IV
Helper IV

Are you looking at a random selection of ID's, a specific set, or are they dependent on another variable? This could affect what DAX Formula you need.

 

Yes, I am looking for random selection of employee badgeID's. Only option to create new measure for SSAS tabular cube data.

 

We don't have access to create table in SSAS tabular cube data. We want to select random of employee badgeids from the 500 employee badge information list.

Team any solution possible for random number of employee selection usind dax measures.

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.