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
Febin
Frequent Visitor

TOTALYTD Giving same value as the source column

Hi,

 

I'm trying to create a simple running total column for the values in "Distance Travelled". My fomula in the column "RunningTotl" is as follows:

 

Febin_0-1664097726844.png

 

I'm having a separate date table "DateDim" with only dates, years and names of month.

 

But my formula is not working. It still gives the same values as the column "Distance Travelled".

 

I have tried the same with measure and using the measure to fill the column, still no use.

 

However, the formula seems to be working fine with a test table i created myself with some random data (see below):

 

Febin_1-1664098274428.png

 

Please help me in figuring this out.

 

Thanks in advance!

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Ok. for the calculated column:

Running total by Year =
VAR _Year =
    YEAR ( fTable[date] )
RETURN
    CALCULATE (
        SUM ( fTable[Value] ),
        FILTER (
            fTable,
            fTable[date] <= EARLIER ( fTable[date] )
                && YEAR ( fTable[date] ) = _Year
        )
    )

calc column.png

 

As a measure

the model:

model.png

YTD measure = 
TOTALYTD(SUM(fTable[Value]), 'Calendar Table'[CalDate])

measure.png

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

4 REPLIES 4
PaulDBrown
Community Champion
Community Champion

Ok. for the calculated column:

Running total by Year =
VAR _Year =
    YEAR ( fTable[date] )
RETURN
    CALCULATE (
        SUM ( fTable[Value] ),
        FILTER (
            fTable,
            fTable[date] <= EARLIER ( fTable[date] )
                && YEAR ( fTable[date] ) = _Year
        )
    )

calc column.png

 

As a measure

the model:

model.png

YTD measure = 
TOTALYTD(SUM(fTable[Value]), 'Calendar Table'[CalDate])

measure.png

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi, Thank you very much!!

  • It worked!
PaulDBrown
Community Champion
Community Champion

Is the a reason you need these calculations as physical columns in a table? Normally these calculations are done using measures to be displayed in visuals in a report





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Not necessarily. But since I'm trying to learn it would be nice if i could have these values in the table as well.

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.