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
sayali_deshmukh
Helper III
Helper III

Calculated column for Daily values from Cumulative values

Hi,
Need a calculated column for daily values from cumulative values type and category wise. Table is as per below -

TypeCategoryDateCumulativeDaily
DomesticA21-04-20201 
DomesticA10-05-20205 
DomesticA11-05-20209 
DomesticB21-04-202015 
DomesticB22-04-202016 
DomesticB29-04-202032 
DomesticB11-05-202032 
DomesticC21-04-20201 
DomesticC22-04-20201 
DomesticC23-04-20201 
DomesticC24-04-20209 
ExportE21-04-202036 
ExportE22-04-202036 
ExportE25-04-202051 
ExportE26-04-202053 
ExportF27-04-202053 
ExportF28-04-202054 
ExportF29-04-202058 
ExportF30-04-202061 
ExportF01-05-202067 
ExportF02-05-202071 
ExportF03-05-202078 
ExportF04-05-202078 
ExportF05-05-202080 
ExportF06-05-202080 
ExportF07-05-202083 
2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@sayali_deshmukh ,

 

Create two calculate columns using dax as below:

Rank = RANKX(FILTER('Table', 'Table'[Type] = EARLIER('Table'[Type]) && 'Table'[Category] = EARLIER('Table'[Category])), 'Table'[Index], , ASC, Dense)

Column = 
VAR Current_Rank = 'Table'[Rank]
VAR Current_CumulativeDaily = 'Table'[CumulativeDaily]
RETURN
    IF (
        Current_Rank = 1,
        Current_CumulativeDaily,
        Current_CumulativeDaily
            - CALCULATE (
                MAX ( 'Table'[CumulativeDaily] ),
                FILTER (
                    'Table',
                    'Table'[Category] = EARLIER ( 'Table'[Category] )
                        && 'Table'[Type] = EARLIER ( 'Table'[Type] )
                        && 'Table'[Rank] = Current_Rank - 1
                )
            )
    )

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

camargos88
Community Champion
Community Champion

Hi @sayali_deshmukh ,


Try this code:

 

Daily = CALCULATE(SUM('Table'[Cumulative]); FILTER('Table'; 'Table'[Type] = EARLIER('Table'[Type]) && 'Table'[Category] = EARLIER('Table'[Category]) && 'Table'[Date] <= EARLIER('Table'[Date])))
 


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



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.