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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

dax measure to calculate number of tickets open at EOM without creating addtional date table

Hi,

I referred to couple links https://community.powerbi.com/t5/Desktop/Calculate-open-tickets-at-the-end-of-the-month/m-p/311142/h...

My requirement is the same.But i am doing this in the ssas tabuar model.I already have a role playing date dimenison in my model,hence i cannot use your solution where you create a calculated date table.

Pls provide a solution for tabular model where it could be acheived as a measure.

I have attached a sample data and expected output file.

 

EOM.PNG

 

 Expected.PNG

 So far,I was have been able to create 2 measure called EOMNEw(count of new tickets open each month) ,EOMClosed (count of closed tickets each month) and Open (subtract EOMNEw and EOMClosed).Open does not depict the correct numbers though,we need to compute Open using EOMNEw/EOMClosed.

EOMNEw =
CALCULATE (
    DISTINCTCOUNT ( [ID] ),
    FILTER (
        Internal,
        (
            Internal[CloseDate] = BLANK ()
                || Internal[CloseDate] > EOMONTH ( [OpenDate], 0 )
        )
         && Internal[OpenDate] <= MAX ( 'Date'[Date] )   
    )
    
    )


EOMClosed =
CALCULATE (
    DISTINCTCOUNT ( Internal[ID] ),
    USERELATIONSHIP ( Internal[CloseDate], 'Date'[Date] )
)

 

Open =
CALCULATE (
    DISTINCTCOUNT ( [id] ),
    FILTER (
        ALL ( Internal ),
        (
            Internal[CloseDate] = BLANK ()
                || Internal[CloseDate] > EOMONTH ( [OpenDate], 0 )
        )
            && Internal[FirstDate] <= MAX ( 'Date'[Date] )
    )
)
    - CALCULATE (
        DISTINCTCOUNT ( [id] ),
        USERELATIONSHIP ( Internal[CloseDate], 'Date'[Date] )
    )

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

One measure could be enough. Please refer to the demo in the attachment that is based on your data here.

Measure =
CALCULATE (
    SUMX (
        ADDCOLUMNS (
            SUMMARIZE ( Internal, 'Date'[Date].[Year], 'Date'[Date].[Month] ),
            "MonthlyTotal", CALCULATE ( DISTINCTCOUNT ( Internal[ID] ) )
                - CALCULATE (
                    DISTINCTCOUNT ( Internal[ID] ),
                    USERELATIONSHIP ( 'Date'[Date], Internal[CloseDate] )
                )
        ),
        [MonthlyTotal]
    ),
    FILTER (
        ALL ( 'Date'[Date] ),
        'Date'[Date] <= EOMONTH ( MAX ( 'Internal'[OpenDate] ), 0 )
    )
)

dax_measure_to_calculate

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

One measure could be enough. Please refer to the demo in the attachment that is based on your data here.

Measure =
CALCULATE (
    SUMX (
        ADDCOLUMNS (
            SUMMARIZE ( Internal, 'Date'[Date].[Year], 'Date'[Date].[Month] ),
            "MonthlyTotal", CALCULATE ( DISTINCTCOUNT ( Internal[ID] ) )
                - CALCULATE (
                    DISTINCTCOUNT ( Internal[ID] ),
                    USERELATIONSHIP ( 'Date'[Date], Internal[CloseDate] )
                )
        ),
        [MonthlyTotal]
    ),
    FILTER (
        ALL ( 'Date'[Date] ),
        'Date'[Date] <= EOMONTH ( MAX ( 'Internal'[OpenDate] ), 0 )
    )
)

dax_measure_to_calculate

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Dale,

Thank a ton!!

 

This approach works,however,there is 1 thing that i want to do.If i slice this by Location[SiteName] it doesnt group by the sites instead gives me some wrong values.The Location dimension has SiteID,Sitename,RegionID,Regionname columns and joined to Internal table with SiteID.When i slice by Sitename from Location,it goves me some junk values.But overall the count per month,per year is correct.

Pls guide.

 

Attached the screenshot.PBI.png

 

 

 

 

 

Hi @Anonymous,

 

Maybe you can add more parameters to the SUMMARIZE. If you want a more detailed solution, I would suggest you open a new thread in this forum with some sample data. 

Measure =
CALCULATE (
    SUMX (
        ADDCOLUMNS (
            SUMMARIZE ( Internal, 'Date'[Date].[Year], 'Date'[Date].[Month], Internal[Site Name] ),
            "MonthlyTotal", CALCULATE ( DISTINCTCOUNT ( Internal[ID] ) )
                - CALCULATE (
                    DISTINCTCOUNT ( Internal[ID] ),
                    USERELATIONSHIP ( 'Date'[Date], Internal[CloseDate] )
                )
        ),
        [MonthlyTotal]
    ),
    FILTER (
        ALL ( 'Date'[Date] ),
        'Date'[Date] <= EOMONTH ( MAX ( 'Internal'[OpenDate] ), 0 )
    )
)

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Dale, I opened a new thread here: https://community.powerbi.com/t5/Developer/summarize-by-site-did-not-return-correct-results/m-p/4885... Please look into it and help me with it.I am stuck at that point.

Anonymous
Not applicable

I would open new thread.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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