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

Power Query/M Code help

Hi Community and Experts,

I am looking for helps and suggestions on the Power Query transformation. This is my initial input:

MemberIDDateStatus
11/1/20211
11/5/20211
12/3/20210
12/5/20211
13/3/20210
13/3/20211
13/8/20211

This is what I am expecting in my output:

MemberIDStart DateEnd Date
11/1/20212/3/2021
12/5/20213/3/2021
13/3/20213/8/2021

1 is active status, 2 is deactivate status. Every time the member logs in, it will be recorded as 1. If the member havent logged in a X number of days, they will be deativated and status set to 0, and has to log in to get their status change to 1. My output is just the number of active days for each member. 

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

Hi @Anonymous,

The simple way is adding two custom columns to extract the date values when status equal to 1 or 0.
Then you can use the 'fill' feature to fill the blank values and add a filter to keep rows that include 'start' and 'end' dates.

Fill values in a column | Microsoft Docs

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

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

The simple way is adding two custom columns to extract the date values when status equal to 1 or 0.
Then you can use the 'fill' feature to fill the blank values and add a filter to keep rows that include 'start' and 'end' dates.

Fill values in a column | Microsoft Docs

Regards,

Xiaoxin Sheng

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

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.