Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Is there a way to use the SAMEPERIODLASTYEAR function in Power BI when your fiscal calendar does not go month to month? Our monthly calendar ends on the last Saturday of the month. So
September 2017 StartDate is 8/28/2016 and ends on 9/24/2016
September 2018 StartDate is 8/27/2017 an ends on 9/30/2017
This is what I have
Last = CALCULATE([Current],SAMEPERIODLASTYEAR('DimDate'[Date]))
Current = CALCULATE(COUNTROWS('FactWholesale'))
Is there another way to get this to work other than SamePeridLastMonth? This is what I am getting
I had posted this a couple days ago but did not understand what was going on when I posted it. I see it now but dont know how to fix it. ANY HELP will be MUCH APPRECIATED.
Solved! Go to Solution.
Hi IAmCare,
As a general solution, you can create a measure using DAX as below:
Last =
VAR one_fiscal_month_ago =
MAX ( FactWholesale[Date] ) - MAX ( FactWholesale[EndDate] )
+ MAX ( FactWholesale[StartDate] )
RETURN
CALCULATE (
COUNTROWS ( FactWholesale ),
FILTER (
FactWholesale,
FactWholesale[Date] >= one_fiscal_month_ago
&& FactWholesale[Date] <= MAX ( FactWholesale[Date] )
)
)
Regards,
Jimmy Tao
Hi IAmCare,
As a general solution, you can create a measure using DAX as below:
Last =
VAR one_fiscal_month_ago =
MAX ( FactWholesale[Date] ) - MAX ( FactWholesale[EndDate] )
+ MAX ( FactWholesale[StartDate] )
RETURN
CALCULATE (
COUNTROWS ( FactWholesale ),
FILTER (
FactWholesale,
FactWholesale[Date] >= one_fiscal_month_ago
&& FactWholesale[Date] <= MAX ( FactWholesale[Date] )
)
)
Regards,
Jimmy Tao
Hi IAmCare ,
Power bi can't achieve the last Saturday of every month automatically, so I would recommend you to create a 'Fiscal Canlendar' tableand input the start date and end date every month to that table. Then create a relationship between two tables.
Regards,
Jimmy Tao
Hi Jimmy, My DimDate has fiscal month start and end dates in it.
How can I use this to get what I need?
Thank you for your response.
This is what I am trying to get to work.
Current = CALCULATE(COUNTROWS('FactWholesale'))
Last = CALCULATE([Current],SAMEPERIODLASTYEAR('DimDate'[Date]))
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
93 | |
87 | |
80 | |
69 | |
68 |
User | Count |
---|---|
226 | |
129 | |
119 | |
83 | |
77 |