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.
I have a table that has data similiar to the table below, I need to calculate net new for each date per category. For example second line would show net new of 33, fourth line net new is 3. I would prefer to use a Calculated column not Measure. Tried different recommendation, nothing worked for Calculated Column (but some formulas worked to create Measure). How can I create a calc column for Net New?
Category | Date | Running total from year start |
A | 01/01/2020 | 12 |
A | 01/02/2020 | 45 |
B | 01/01/2020 | 2 |
B | 01/02/2020 | 5 |
Solved! Go to Solution.
Hi,
Try this calculated column formula
=if(ISBLANK(CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Category]=EARLIER(Data[Category])&&Data[Date]<EARLIER(Data[Date])))),BLANK(),Data[Running total from year start]-LOOKUPVALUE(Data[Running total from year start],Data[Date],CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Category]=EARLIER(Data[Category])&&Data[Date]<EARLIER(Data[Date]))),Data[Category],Data[Category]))
Hope this helps.
I believe EARLIER is best for you if you want a calculated column.
Column =
var current_day = CALCULATE(SUM('Table'[Runningtotal]),FILTER('Table','Table'[Date] = EARLIER('Table'[Date]) && 'Table'[Category]=EARLIER('Table'[Category])))
var previous_day = CALCULATE(SUM('Table'[Runningtotal]),FILTER('Table','Table'[Date] = EARLIER('Table'[Date])-1 &&'Table'[Category]=EARLIER('Table'[Category])))
Return current_day - previous_day
Paul Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Try this calculated column formula
=if(ISBLANK(CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Category]=EARLIER(Data[Category])&&Data[Date]<EARLIER(Data[Date])))),BLANK(),Data[Running total from year start]-LOOKUPVALUE(Data[Running total from year start],Data[Date],CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Category]=EARLIER(Data[Category])&&Data[Date]<EARLIER(Data[Date]))),Data[Category],Data[Category]))
Hope this helps.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |