Forum Discussion
help on sameperiodelast year
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 )
- PowerBIBeginer2 years agoHelper V
Thank you so much for your reply and valuable time share for me. Let me try this and will update you on the same..
- PowerBIBeginer2 years agoHelper V
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]))- Ashish_Mathur2 years agoSuper User
Hi,
You have not created a calendar Table, as suggested by Jihwan. Study his solution carefully.
- PowerBIBeginer2 years agoHelper V
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
- PowerBIBeginer2 years agoHelper V
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
- Jihwan_Kim2 years agoSuper User
Hi,
Please share your sample pbix file's link, and then I can try to look into it.
Thank you.
- PowerBIBeginer2 years agoHelper V
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