Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
how would you do calculation for YTD, unless it's Q1 of a new year then give the total YTD of last year.
How would that look?
TIA
Solved! Go to Solution.
Hi @agd50 ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
1.Create a measure
YTD_Conditional =
VAR CurrentQuarter = QUARTER(TODAY())
VAR CurrentYear = YEAR(TODAY())
RETURN
IF(
CurrentQuarter = 1,
CALCULATE(
SUM('Table'[Amount]),
FILTER(
ALL('Table'),
YEAR('Table'[Date]) = CurrentYear - 1
)
),
TOTALYTD(
SUM('Table'[Amount]),
'Table'[Date]
)
)
2.Final output
Please note that today() is 2024/01/11
Best regards
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @agd50 ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
1.Create a measure
YTD_Conditional =
VAR CurrentQuarter = QUARTER(TODAY())
VAR CurrentYear = YEAR(TODAY())
RETURN
IF(
CurrentQuarter = 1,
CALCULATE(
SUM('Table'[Amount]),
FILTER(
ALL('Table'),
YEAR('Table'[Date]) = CurrentYear - 1
)
),
TOTALYTD(
SUM('Table'[Amount]),
'Table'[Date]
)
)
2.Final output
Please note that today() is 2024/01/11
Best regards
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hello,
Please try the following DAX:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
121 | |
113 | |
73 | |
65 | |
46 |