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.
Hi All,
I've one Dax which gives me no of volume and have derived with help of Dax. Now problem is, I've 2024 year-month column, i also derived last year 2023 year-month column. infact I've volume for current year and 2023 as well by creating 2 dax.. but dont know how to get that values against every month.. for e.g. below is the scenario.
Now I dont understand how I can get volume 2023 values next to 150, 250 & 350 i.e. 100,200,300 and then I want new colume after volume 2023 "Difference" so minus of 150-100 value need in that column..
current year | previous year | volume 2024 | volume 2023 |
| Jan-2023 | - | 100 |
Feb-2023 | - | 200 | |
Mar-2023 | - | 300 | |
Jan-2024 | Jan-2023 | 150 | - |
Feb-2024 | Feb-2023 | 250 | - |
Mar-2024 | Mar-2023 | 350 | - |
Can any one please guide here..
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Volume measure: =
SUM( volume_fact[volume] )
Previous year volume measure: =
CALCULATE (
SUM ( volume_fact[volume] ),
SAMEPERIODLASTYEAR ( calendar_dimension[Date] )
)
Difference measure: =
VAR _current = [Volume measure:]
VAR _previous = [Previous year volume measure:]
VAR _condition =
_current <> BLANK ()
&& _previous <> BLANK ()
&& HASONEVALUE ( calendar_dimension[Month-Year] )
RETURN
IF ( _condition, _current - _previous )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi Jihwan_Kim, I used now date table field date column and I got the values, but as per SAMEPeriodelastyear dax, against Jan 2024 its not showing me Jan 2023 value.
belwo is the snip
Hi,
Please share your sample pbix file's link, and then I can try to look into it.
Thank you.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
this is the main table from where i pulll volume (i.e.output column)-
in example I purposefully change names.. I cant share pbi file since in transform data more tables are connected to main table (main table my naming conv is tblname)
date table
model view
and here's the dax
Hi,
In the Calendar Table, create calculated column formulas for Year, Month name and Month number. Sort the Month name column by the Month number. To your visual, drag Year and Month name from the Calendar Table.
Hi,
In the Calendar Table, create calculated column formulas for Year, Month name and Month number. Sort the Month name column by the Month number. To your visual, drag Year and Month name from the Calendar Table.
Hi Jihwan_Kim.. Appriciate your effort for understanding mu issue exactly well and try to plot across very nicely. I would like to hightlight here something that, Volume Measure you've taken simply sum of one column, even I do that but using one filter condition in that.
for e.g.
volume = calculate(sum(tblname[volume]), tblname[onecolumn]="VC")
and hence I designed Previous year Volume like below but I got blanks..
Previuos year volume = CALCULATE(
SUM(tblname[Volume]),
tblname[onecolumn]="VC",
SAMEPERIODLASTYEAR(tblname[date]))
Hi,
You have not created a calendar Table, as suggested by Jihwan. Study his solution carefully.
Hello Ashish Sir, please refer post no 6 in which I post that I've now used date table and date field even and I got the values but against 2024 2023 value is not appearing
Thank you so much for your reply and valuable time share for me. Let me try this and will update you on the same..
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
98 | |
96 | |
84 | |
70 | |
67 |
User | Count |
---|---|
116 | |
109 | |
94 | |
79 | |
72 |