The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I have a table tickets, with two dates. Opening Date and solution Date. I relate them through a calendar table.
N_TicketsOpening = CALCULATE (COUNT (CCBI_vwTickets [TicketId]), CCBI_vwTickets [OpeningDate])
And I need a measure that counts the tickets from the same previous period.
I tried
N_TicketsOpening_LY = CALCULATE (COUNT (CCBI_vwTickets [TicketId]), SAMEPERIODLASTYEAR (CCBI_vwTickets [OpeningDate]))
but it doesn't work, it doesn't show data.
I put a page filter that selects the last 12 calendar months.
Solved! Go to Solution.
Hi @DavidEg
My Sample:
I add YearMonth into Page filter and select 202101 and 202112.
Please try my measure:
N_TicketsOpening_LY =
VAR _CurYear = YEAR(MAX(CCBI_vwTickets[OpeningDate]))
Return
CALCULATE(COUNT(CCBI_vwTickets[TicketId]),FILTER(ALL(CCBI_vwTickets),YEAR(CCBI_vwTickets[OpeningDate])=_CurYear-1))
Result is as below.
If this reply still couldn't help you solve your problem, please show me a sample like what you are dealing with by your Onedrive for Business.
This will make it easier for me to understand your requirement.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @DavidEg
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou
Hi @DavidEg
My Sample:
I add YearMonth into Page filter and select 202101 and 202112.
Please try my measure:
N_TicketsOpening_LY =
VAR _CurYear = YEAR(MAX(CCBI_vwTickets[OpeningDate]))
Return
CALCULATE(COUNT(CCBI_vwTickets[TicketId]),FILTER(ALL(CCBI_vwTickets),YEAR(CCBI_vwTickets[OpeningDate])=_CurYear-1))
Result is as below.
If this reply still couldn't help you solve your problem, please show me a sample like what you are dealing with by your Onedrive for Business.
This will make it easier for me to understand your requirement.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@DavidEg - If you are using a page filter, then you will not be able to get those rows back via DAX using ALL or ALLEXCEPT, etc. Page filters pre-filter the rows available to DAX calculations.
Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...