March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi, I have a requirement here:
I have data like below:
I need the output in Power BI as:
There will be a slicer to select year. When I select Year as 18 in the slicer, it should list data only for Year 2018 where the Profit for year 2018 is compared with Profit of 2017 and added into a column. It should be seen like below:
Any Ideas?
Solved! Go to Solution.
May be this Column
Column = VAR Previous_Year = CALCULATE ( SUM ( Table1[Profit] ), ALLEXCEPT ( Table1, Table1[Product] ), SAMEPERIODLASTYEAR ( Table1[Date] ) ) RETURN IF ( NOT ( ISBLANK ( Previous_Year ) ), Table1[Profit] - Previous_Year )
Try this measurE
Measure = VAR Previous_Year = CALCULATE ( SUM ( Table1[Profit] ), ALLEXCEPT ( Table1, Table1[Product] ), SAMEPERIODLASTYEAR ( Table1[Date] ) ) RETURN SUM ( Table1[Profit] ) - Previous_Year
Hi Zubair,
Your code works great for a Measure. Thanks for it. I actually need to create a new Column with these values, so that I can use the column for further calculations. Can you think of DAX to create new column for same requirement ???
May be this Column
Column = VAR Previous_Year = CALCULATE ( SUM ( Table1[Profit] ), ALLEXCEPT ( Table1, Table1[Product] ), SAMEPERIODLASTYEAR ( Table1[Date] ) ) RETURN IF ( NOT ( ISBLANK ( Previous_Year ) ), Table1[Profit] - Previous_Year )
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
91 | |
88 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
73 | |
68 |