Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
VMP
Frequent Visitor

YTD Calculation without Date table

Hello,

 

I have data which have only Period column, e.g 2024-P01, 2024-P02...., no sequential date. My dashboard has Period slicer. I have tired both below options to calculate YTD though I am getting only selected period amounts. What is that I am missing, how can I fix it?   Appreciate your expertise.

 

Option 1 
Cost YTD =
CALCULATE(
        SUM(Inventory[Total Cost]),
        FILTER(
            ALL(Inventory[Period]),
            Inventory[Period] <= SELECTEDVALUE('Period A'[Period])
        )
)

Option 2
YTD Cost =
VAR SelectedPeriod = SELECTEDVALUE('Period A'[Period])
RETURN
CALCULATE(
    SUM(Inventory[Total Cost]),
    FILTER(ALL(Inventory[Period]),
        Inventory[Period] <= SelectedPeriod)
)



1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @VMP ,

 

Thanks for the reply from aduguid / Greg_Deckler .

 

Create a calculated column in each of the two tables, convert the text format Period to an integer format Period for easy comparison.

Period Num =
VALUE(LEFT('Inventory'[Period], 4)) * 100 + VALUE(RIGHT('Inventory'[Period], 2))

Period No =
VALUE(LEFT('Period A'[Period], 4)) * 100 + VALUE(RIGHT('Period A'[Period], 2))

 

The two tables need to be disconnected.

vhuijieymsft_0-1718244257860.png

 

Create a measure to calculate YTD:

Cost YTD =
VAR SelectedNo = SELECTEDVALUE('Period A'[Period No])
RETURN
CALCULATE(
SUM(Inventory[Total Cost]),
FILTER(
ALL('Inventory'[Period Num]),
'Inventory'[Period Num] <= SelectedNo
)
)

 

The final page visual effect is as shown below:

vhuijieymsft_1-1718244257863.png

 

If you have any other questions please feel free to contact me.

 

The pbix file is attached.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @VMP ,

 

Thanks for the reply from aduguid / Greg_Deckler .

 

Create a calculated column in each of the two tables, convert the text format Period to an integer format Period for easy comparison.

Period Num =
VALUE(LEFT('Inventory'[Period], 4)) * 100 + VALUE(RIGHT('Inventory'[Period], 2))

Period No =
VALUE(LEFT('Period A'[Period], 4)) * 100 + VALUE(RIGHT('Period A'[Period], 2))

 

The two tables need to be disconnected.

vhuijieymsft_0-1718244257860.png

 

Create a measure to calculate YTD:

Cost YTD =
VAR SelectedNo = SELECTEDVALUE('Period A'[Period No])
RETURN
CALCULATE(
SUM(Inventory[Total Cost]),
FILTER(
ALL('Inventory'[Period Num]),
'Inventory'[Period Num] <= SelectedNo
)
)

 

The final page visual effect is as shown below:

vhuijieymsft_1-1718244257863.png

 

If you have any other questions please feel free to contact me.

 

The pbix file is attached.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Greg_Deckler
Community Champion
Community Champion

@VMP Done a lot with this. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

 

Also this:

(1) Better Year to Date Total - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
aduguid
Super User
Super User

I'd create a new column with a formatted period number, as in "202401". You can do that in Power Query by duplicating the column and then replacing the string "-P" to "". Then update your filters to use the new period number column.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors