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
Dears,
Please advise below DAX with Sameperiodlast year not working..
Also if I remove Filter :
Solved! Go to Solution.
I think best thing is to do is create 2 filters
- One with your actual measures with Filter
SalaryWithCC(WithoutWPS) = CALCULATE(SUM(ZFAGLFLEXA_FI_DOC[NEWHSL]) ,FILTER(ZFAGLFLEXA_FI_DOC,ZFAGLFLEXA_FI_DOC[RCNTR] <> "" ),FILTER(GLMapping,GLMapping[GLGroup_Index]="3"),FILTER(ZCEPCT_PRFT_TXT,ZCEPCT_PRFT_TXT[INCGRP1]="INCGRP1") )
- After that you should create Last Year Measure
SalaryWithCC(WithoutWPS) Last Year = CALCULATE( SalaryWithCC(WithoutWPS), SAMEPERIODLASTYEAR (Calendar[Date]))
Make sure that your calendar is marked as "Date Table"
Proud to be a Super User!
Hi @unais ,
It's best to share us your .pbix file for test. Please remove sensitive information and unnecessary visuals. It is suggested to upload your file to OneDrive for Business and then paste the link here.
Best Regards,
Icey
@unais , use
not(isblank(ZFAGLFLEXA_FI_DOC[RCNTR] )) for ZFAGLFLEXA_FI_DOC[RCNTR] <> ""
Also, make sure your calendar table is marked as date table.
Example of other ways
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
refer
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
Appreciate your Kudos.
I had created Two Mesure
like below
I think best thing is to do is create 2 filters
- One with your actual measures with Filter
SalaryWithCC(WithoutWPS) = CALCULATE(SUM(ZFAGLFLEXA_FI_DOC[NEWHSL]) ,FILTER(ZFAGLFLEXA_FI_DOC,ZFAGLFLEXA_FI_DOC[RCNTR] <> "" ),FILTER(GLMapping,GLMapping[GLGroup_Index]="3"),FILTER(ZCEPCT_PRFT_TXT,ZCEPCT_PRFT_TXT[INCGRP1]="INCGRP1") )
- After that you should create Last Year Measure
SalaryWithCC(WithoutWPS) Last Year = CALCULATE( SalaryWithCC(WithoutWPS), SAMEPERIODLASTYEAR (Calendar[Date]))
Make sure that your calendar is marked as "Date Table"
Proud to be a Super User!
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
93 | |
92 | |
86 | |
77 | |
49 |
User | Count |
---|---|
166 | |
149 | |
99 | |
73 | |
57 |