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

Var to filter table return to excute distinctcount

I have a Data table with data rows that denote each record ( with unique ID ) by program , by location by date.
ID. Program Location Date
1. A. XXX. 1.1.2019
2. A YYY. 2.1.2019
3. B XXX. 3.1.2019
1. A. XXX. 3.1.2019
I’ve also create Dim table for Program , Location & Date respectively & all have relationship with Data table.
Intend to use dax 1) with use of Var to filter the record By ID for only a program ,
and 2) to return a Distinct count to sieve out by ID for a specific date range as new unique record .
Below Dax work for part 2 ( can pick out new unique record )but cannot incorporate part 1.
New unique =
Var Attendee = values(‘Data [ID])
return COUNTROWS(filter(Attendee,CALCULATE ( COUNTROWS(‘Data, filter( ALLSELECTED( ‘Dim Dates[dates]),’Dim dates[dates]< min (‘Dim Dates[ dates] )))= 0 ))
4 REPLIES 4
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

I’ve also create Dim table for Program , Location & Date respectively & all have relationship with Data table.
Intend to use dax 1) with use of Var to filter the record By ID for only a program ,
and 2) to return a Distinct count to sieve out by ID for a specific date range as new unique record .
Below Dax work for part 2 ( can pick out new unique record )but cannot incorporate part 1.
New unique =
Var Attendee = values(‘Data [ID])
return COUNTROWS(filter(Attendee,CALCULATE ( COUNTROWS(‘Data, filter( ALLSELECTED( ‘Dim Dates[dates]),’Dim dates[dates]< min (‘Dim Dates[ dates] )))= 0 ))

Could you please also share your sample dim table and expected result?

 

Regards,

Jimmy Tao

Anonymous
Not applicable

Jimmy
Sample of the Dim table for Program
Program. Program category
A. Categ 1
B. Categ 1
C. Categ 2
D Categ 2

DAX is to sieve through the data tables record, and use the date field to find if specific record (ID) is 1st time - eg a new customer .

As 2nd explained in earlier post , I believe 2nd part of the dax ( using filter of all selected date) is able to filter such records and do a record count.

My issue is that I also like to sieve through the data tables only for specific program ( eg static program A ) . I can’t find a way to add in this filter of another column

CheenuSing
Community Champion
Community Champion

Hi @Anonymous ,

 

Can you uplload sampledata,pbix and output expected to Google / OneDrive and share the link here to understand better and formulate a solution.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
Anonymous
Not applicable

CheenuSing
Thanks for response but I can’t share pbi file. I have added more information on my issue as rely to Jimmy . Please see if that help to understand my issue

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.