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
MohammedGouse
New Member

Dax Logic

Hi Team,

I have table Name Attendees, Columns Attendee Date, and AttendeeID.
Created a Measure,  Distinct Count of attendees.

Under Slicer Between Attendees Date Has taken, now the requirement is, I need to calculate the Returning and New Customers Count KPI
Eg : Attendee Date 1st Jan to 31st Jan 
Count Attendees: 50 
Returning: Need to check one year from Selected Time Period and above 5o Count is there anyone has attended the Session. if yes that count has to come under Returning KPI
so please help to create Dax on this Requirement


1 ACCEPTED SOLUTION

Hi @MohammedGouse,

So you mean want to two step calculation to get the record count that both include current month and previous month?

If that is the case, you can add a variable and replace the raw formula count calculation with VALUES function to extract and store the id list. Then you can extract the previous month id list and use INTERSECT function to compare with above list to get the 'return' count.

INTERSECT function (DAX) - DAX | Microsoft Learn

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

5 REPLIES 5
olgad
Super User
Super User

Hi, this is how you calculate generally the number of returning:
Returning Attendees=
CALCULATE( DISTINCTCOUNT('your_table_name'[attendee_id]),
FILTER( ALL('your_table_name'),
CALCULATE( COUNTROWS('your_table_name'),
FILTER( ALL('your_table_name'), 'your_table_name'[attendee_id] = EARLIER('your_table_name'[attendee_id]) ) ) > 1 ) )


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

Hi Olgad,

 

Thanks for the Query but actually  The Requirement
 In Date Slicer i have Selected the Time Period 01/01/2022 to 01/31/2022 and the Count is 31 List of Employees were Snip Added 
So Before that date we have 2021 Data As well 
Now if select the Date Slicer as above mentioned Date Jan1st to 31st Jan Attedees are 31 , I need to Write a Dax Query any on of this 31 were attended Previous Month 
if they have attended those count has comes under Returning. I have Adde the Image Please Review Once 
As per Data It Should come under returning as 14 Count .

MohammedGouse_0-1680369761572.png

 

Hi @MohammedGouse,

So you mean want to two step calculation to get the record count that both include current month and previous month?

If that is the case, you can add a variable and replace the raw formula count calculation with VALUES function to extract and store the id list. Then you can extract the previous month id list and use INTERSECT function to compare with above list to get the 'return' count.

INTERSECT function (DAX) - DAX | Microsoft Learn

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Greg_Deckler
Super User
Super User

@MohammedGouse Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

MohammedGouse_0-1680355020087.png

MohammedGouse_1-1680355489280.png

 

Attaching the PBIX file for Refrence 
Above Mentioned the image the Date range 1st Jan to 31st Jan  Count of attendees were = 31 
so the Requirement is need to create One more KPI Returning  if any of this 31 attendees are attended before Jan 1st 2022 then that Count has to come under Returning Attendee 

i am Unable to Attach Pbix Contten ading under Table 


 

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.

Top Solution Authors