Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Community Champion
Community Champion

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.