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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
Microsoft Employee
Microsoft 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
Microsoft Employee
Microsoft 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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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