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

Normalize time series data to first non-zero

I have a time-series table that has daily date resolution. The table has unique properties that have individual arrays with varying first production dates. What I want to be able to do is a build a visualization that aggregates common properties but summarizes the production arrays to Day 0 equaliing the First Non-Zero value.

 

For example, if Property A has its first non-zero value on 2/15 and equals 10 units while Property B has its first non-zero value on 3/1 and equals 20 units

 

Then I want the visualization to aggregate Day 0 to Day 365 and Day 0 would equal 30 units in this case. 

 

Thanks for the help

1 ACCEPTED SOLUTION

@Anonymous,

Please create the following measure and check column in your original table.

Measure = MAXX(Table1,CALCULATE(MIN(Table[Date]),FILTER(ALL(Table), Table[ID]= EARLIER(Table[ID])&&Table[Production]>0)))
Check = IF([Measure]<=Table[Date],1,0)


Then create new table using DAX below.

NewTable = CALCULATETABLE(Table,Table[Check]>0)


And change DAX of Index column to the following:

Index = RANKX(FILTER(NewTable,NewTable[ID]=EARLIER(NewTable[ID])),[Date],,ASC,Dense)



Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yuezhe-msft
Employee
Employee

@Anonymous,

I make a test in my sample table.

1.PNG

Firstly, create a new table using DAX below.

NewTable = CALCULATETABLE(TEST,TEST[unit]>0)


Secondly, create the following columns in the new table.

Index = RANKX(FILTER(NewTable,NewTable[property]=EARLIER(NewTable[property])),[Date],,ASC,Dense)
Day = "Day" &(NewTable[Index]-1)


At last, create chart as below. If the above DAX don't help, please share sample data of your table for us to analyze.
2.PNG


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I have a follow up question. It is not unusual that some of the data arrays will have zero values following the first non-zero value. I'd like to include these in the evaluation, so in this case, we are only filtering out all zeros before the first non-zero. 

 

How could I modify the calculatetable formula in that regard?

@Anonymous,

Could you please share sample data of your table here?


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yuezhe-msft

 

IDDateProduction
A1/1/20190
A1/2/20190
A1/3/20190
A1/4/20190
A1/5/20190
A1/6/20190
A1/7/20190
A1/8/20190
A1/9/201910
A1/10/201920
A1/11/201930
A1/12/201940
A1/13/201950
A1/14/201950
A1/15/201950
A1/16/20190
A1/17/20190
A1/18/20190
A1/19/20190
A1/20/20190
A1/21/20190
A1/22/201910
A1/23/201920
A1/24/201930
A1/25/201940
A1/26/201950
A1/27/201950
A1/28/201950
A1/29/201950
A1/30/201950
A1/31/201950

@Anonymous,

Please create the following measure and check column in your original table.

Measure = MAXX(Table1,CALCULATE(MIN(Table[Date]),FILTER(ALL(Table), Table[ID]= EARLIER(Table[ID])&&Table[Production]>0)))
Check = IF([Measure]<=Table[Date],1,0)


Then create new table using DAX below.

NewTable = CALCULATETABLE(Table,Table[Check]>0)


And change DAX of Index column to the following:

Index = RANKX(FILTER(NewTable,NewTable[ID]=EARLIER(NewTable[ID])),[Date],,ASC,Dense)



Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you. That was perfect. Appreciate the help

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.