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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Creating Table and Adding Column From Existing Table

Hi, I'm inserting a new table and got part of it working properly but can't figure out how to get through one more step.  I've used the below DAX to summarize our cases sitting in an open status on any given date:

 

 

 

 

 

 

Open Cases = 
ADDCOLUMNS (
    CALENDAR (date(2021,1,1), max('Case History'[CreatedDate])),
    "Count", CALCULATE (
        DISTINCTCOUNT ( 'Case History'[CaseNumber] ),
        FILTER (
            'Case History',
            'Case History'[CreatedDate] <= [Date]
                && (
                    'Case History'[ClosedDate] > [Date]
                        || ISBLANK ( 'Case History'[ClosedDate] )
                )
        )
    )
)

 

 

 

 

 

 

 

And this works as expected giving the results below:

a299epw_0-1644505084955.png

 

However I'd like to get the Count split for each date by another field 'Case History'[Origin] from the same existing Case History table.  I've tried working with SUMMARIZE and some other options but keep getting errors so not sure what I'm doing wrong.  The ideal output I'd like to have is below, if anyone could please help point me in the right direction?

a299epw_1-1644505443655.png

 

EDIT: Sample table data:

CreatedDateClosedDateCaseNumberOrigin
1/3/20211/3/20211Customer Initiated
12/20/20201/3/20212Customer Initiated
1/2/20211/4/20213Customer Initiated
12/2/2020 4Internal
12/31/20201/2/20215Internal
12/1/202012/9/20206Internal
1/2/20211/3/20217Customer Initiated
1/1/2021 8Customer Initiated
1/6/2021 9Customer Initiated
1/1/20211/8/202110Internal

 

Using this sample, I'd like to see results of the 'open case' table as something like this:

Snapshot DateOpen CountOrigin
1/1/20213Internal
1/1/20212Customer Initiated
1/2/20212Internal
1/2/20214Customer Initiated
1/3/20212Internal
1/3/20212Customer Initiated
1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please try the following formula:

Open Cases = 
ADDCOLUMNS (
    CROSSJOIN( CALENDAR (date(2021,1,1), max('Case History'[CreatedDate])), DISTINCT('Case History'[Origin]) ),
    "Count", CALCULATE (
        DISTINCTCOUNT ( 'Case History'[CaseNumber] ),
        FILTER (
            'Case History',
            'Case History'[CreatedDate] <= [Date]
                && 'Case History'[Origin] = EARLIER('Case History'[Origin])
                && (
                    'Case History'[ClosedDate] > [Date]
                        || ISBLANK ( 'Case History'[ClosedDate] )
                )
        )
    )
)

vkkfmsft_0-1644980166401.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

6 REPLIES 6
lbendlin
Super User
Super User

Instead of 

 

 

ADDCOLUMNS (
    CALENDAR (date(2021,1,1), max('Case History'[CreatedDate])),

 

 

You would say something like 

 

 

ADDCOLUMNS (
    CROSSJOIN(CALENDAR (date(2021,1,1), max('Case History'[CreatedDate])),VALUES('Case History'[Origin])),

 

 

and then apply the Origin filter as needed.

Anonymous
Not applicable

Cool thank you, that did work to add the Origin column in, separating into different rows for the different Origin values, I just have one more question.  The Counts are showing the monthly totals as the same for each Origin row rather than subdividing the totals, I've tried to do some things with the filter but no luck; do you know how I'd resolve that? 

a299epw_0-1644849989780.png

 

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Please show the expected outcome.


Anonymous
Not applicable

Sure, edited my initial message to include a table of sample data and expected results

Hi @Anonymous ,

 

Please try the following formula:

Open Cases = 
ADDCOLUMNS (
    CROSSJOIN( CALENDAR (date(2021,1,1), max('Case History'[CreatedDate])), DISTINCT('Case History'[Origin]) ),
    "Count", CALCULATE (
        DISTINCTCOUNT ( 'Case History'[CaseNumber] ),
        FILTER (
            'Case History',
            'Case History'[CreatedDate] <= [Date]
                && 'Case History'[Origin] = EARLIER('Case History'[Origin])
                && (
                    'Case History'[ClosedDate] > [Date]
                        || ISBLANK ( 'Case History'[ClosedDate] )
                )
        )
    )
)

vkkfmsft_0-1644980166401.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

That completed it, thank you both so much in getting me on the right track!  I really appreciate y'all helping me out.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.