cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Matheus_Lima
New Member

TOTAL TICKETS BASED ON DATASET FILTER

Hello,

I'm facing some challange with a topic and i'd like some help.

 

I have two work on a report with only 1 table. (Issues)

 

1 - I have a date slicer ('Issues'[Criado]), that i use to filter tickets in my report.
2 - Also have two calculate fields, a date min (_date_min), and a date max (_date_max),that i can get the dates selected on date slicer.

3 - Also a datediff calculate field, where i can get a period of consulting.

 

 

The challange is: 
Based on a date selected in the slicer, get the actual total of issues, and compare with the total of issues previous based in the slicer.

(Example:

1 - Date set in Slicer: 09/09/2022 to 10/09/2022

2 - Calculate the DATEDIFF. (in that case will be 1)

3 - Get the total of actual Issues.

4 - Based in DATEDIFF, the previsous date to get comparison: 08/09/2022 to 09/09/2022

5 - Get the total of Issues in previous date.

6 - Use the total of issues in previous date as GOAL to comparate the total of actual issues.

)

 

 

Now i'm stuck in get the total of previous tickets.

Matheus_Lima_0-1662864181942.png

 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Matheus_Lima 

Thanks for reaching out to us.

Use the selectedvalue() function to get the date in the slicer, and then use the set date range to get the count in the corresponding range, you can refer to this solution, Running total for a prior year based on slicer Dat... - Microsoft Power BI Community

Transactions Cumulative Current Period (last year) =
IF (
    COUNTROWS ( 'Confirmed Transactions' ) > 0,
    CALCULATE (
        [Transactions Cumulative Current Period],
        SAMEPERIODLASTYEAR (
            FILTER ( ALLSELECTED ( Dates[Date] ), 'Dates'[Date] <= MAX ( Dates[Date] ) )
        )
    )
)

or something like

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,max(dateadd(date[date]),-1,year))))

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @Matheus_Lima 

Thanks for reaching out to us.

Use the selectedvalue() function to get the date in the slicer, and then use the set date range to get the count in the corresponding range, you can refer to this solution, Running total for a prior year based on slicer Dat... - Microsoft Power BI Community

Transactions Cumulative Current Period (last year) =
IF (
    COUNTROWS ( 'Confirmed Transactions' ) > 0,
    CALCULATE (
        [Transactions Cumulative Current Period],
        SAMEPERIODLASTYEAR (
            FILTER ( ALLSELECTED ( Dates[Date] ), 'Dates'[Date] <= MAX ( Dates[Date] ) )
        )
    )
)

or something like

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,max(dateadd(date[date]),-1,year))))

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

PaulDBrown
Super User
Super User

Please share sample non-confidential data or a link to a PBIX file.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
Winner of T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Find out who won the T-Shirt Design Challenge and the top 3 finalists.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.