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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
asfasfgasfg
Frequent Visitor

DAX measure YTD based on Filter and without date column in visual - Error

The measure I created only shows the entire year.
When I Filter the months I want it to show me the YTD value.
 
Last Year = CALCULATE(sum('Palmo_Transactions'[AmountFC]),filter(ALL('DateTable'),'DateTable'[Year]=[CurrentYear]-1))
Shows Entire year.
 
I need it to show YTD values but it gives me a placeholder error
Last Year = CALCULATE(sum('Palmo_Transactions'[AmountFC]),DATESYTD('DateTable'[DAY_DATE]),FILTER('DateTable',DateTable[Year]=([CurrentYear]-1)))
 
Can anyone help me with this please?
 
 
1 ACCEPTED SOLUTION

Hi @asfasfgasfg 

I make some change to your three measures:

Huidig Jaar = CALCULATE(
    sum(
        Palmo_Transactions[AmountFC]),
        filter(
          ALLSELECTED(Palmo_Transactions),[Date]<=MAX(DateTable[DAY_DATE])&&YEAR(Palmo_Transactions[Date])=[CY])
            )
Twee jaar terug = 
CALCULATE(
    sum(
        Palmo_Transactions[AmountFC]),
        filter(
          ALLSELECTED(Palmo_Transactions),[Date]<=MAX(DateTable[DAY_DATE])&&YEAR(Palmo_Transactions[Date])=[CY]-2)
            )
Vorig Jaar = CALCULATE(
    sum(
        Palmo_Transactions[AmountFC]),
        filter(
          ALLSELECTED(Palmo_Transactions),[Date]<=MAX(DateTable[DAY_DATE])&&YEAR(Palmo_Transactions[Date])=[CY]-1)
            )

Output:

vxinruzhumsft_0-1673514292490.png

 

vxinruzhumsft_1-1673514301503.png

Best Regards!

Yolo Zhu

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

4 REPLIES 4
Padycosmos
Solution Sage
Solution Sage
v-xinruzhu-msft
Community Support
Community Support

Hi @asfasfgasfg 

I test your code, it works on my table

vxinruzhumsft_0-1673320821386.png

The following is my table relationship:

vxinruzhumsft_1-1673320849988.png

 

Can you provide some sample data or pbix file?

Or you can try to delete the measure and create it again.

Best Regards!

Yolo Zhu

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

https://drive.google.com/file/d/1ggd2QiTbAslJGYKvg3WYX9oQL4ED8osx/view?usp=share_link 

 

Here is a link to the PBIX file

I don't have the date column in my visual.

Edit File is now free to everyone with access to the link. sorry..

Hi @asfasfgasfg 

I make some change to your three measures:

Huidig Jaar = CALCULATE(
    sum(
        Palmo_Transactions[AmountFC]),
        filter(
          ALLSELECTED(Palmo_Transactions),[Date]<=MAX(DateTable[DAY_DATE])&&YEAR(Palmo_Transactions[Date])=[CY])
            )
Twee jaar terug = 
CALCULATE(
    sum(
        Palmo_Transactions[AmountFC]),
        filter(
          ALLSELECTED(Palmo_Transactions),[Date]<=MAX(DateTable[DAY_DATE])&&YEAR(Palmo_Transactions[Date])=[CY]-2)
            )
Vorig Jaar = CALCULATE(
    sum(
        Palmo_Transactions[AmountFC]),
        filter(
          ALLSELECTED(Palmo_Transactions),[Date]<=MAX(DateTable[DAY_DATE])&&YEAR(Palmo_Transactions[Date])=[CY]-1)
            )

Output:

vxinruzhumsft_0-1673514292490.png

 

vxinruzhumsft_1-1673514301503.png

Best Regards!

Yolo Zhu

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

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.