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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Creating a distinct table for each month using a Dates Table and another table

Hello there,

 

I have a table that has daily inputs for job orders that looks like this:

 

DateFull Plate NumberMonth
1/1/2021Job Order 1Jan
1/1/2021Job Order 2Jan
1/1/2021Job Order 3Jan
1/1/2021Job Order 4Jan
1/2/2021Job Order 3Jan
1/2/2021Job Order 4Jan
1/2/2021Job Order 5Jan
1/2/2021Job Order 6Jan
2/1/2021Job Order 5Feb
2/1/2021Job Order 6Feb
2/1/2021Job Order 7Feb
2/1/2021Job Order 8Feb
2/2/2021Job Order 7Feb
2/2/2021Job Order 8Feb
2/2/2021Job Order 9Feb
2/2/2021Job Order 10Feb
2/2/2021Job Order 11Feb

 

I'm trying to create a table using DAX that would give me a distinct count of a given month generating a table that looks like this:

 

MonthDistinct Item of that month
JanJob Order 1
JanJob Order 2
JanJob Order 3
JanJob Order 4
JanJob Order 5
JanJob Order 6
FebJob Order 5
FebJob Order 6
FebJob Order 7
FebJob Order 8
FebJob Order 9
FebJob Order 10
FebJob Order 11

 

so far I have tried..

JobOrderSummery =
Var _Date = GENERATE(CALENDAR(DATE(2021,1,1),DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY()))),VAR CurrentDate = [Date])
RETURN
CROSSJOIN(CALENDAR(DATE(2021,1,1),DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY()))),CALCULATETABLE(SUMMARIZE(MaintParetoTbl,MaintParetoTbl[Job Order Number]),MaintParetoTbl[Job Order Number] <> "",MaintParetoTbl[Date(Month)] = [Date] ))
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@amitchandak what ended up working thanks to your inspiration was

 

CALCULATETABLE(CROSSJOIN(DISTINCT([Date(Month)]),DISTINCT([Job Order])),Filter)

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Have you tried like

crossjoin(distinct(Table[Date Full]), Distinct( Table[Plate Number])

 

or

 

crossjoin(CALENDAR(DATE(2021,1,1),TODAY()), Distinct( Table[Plate Number])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak that is giving me all the months I only want the months that exist

Anonymous
Not applicable

@amitchandak what ended up working thanks to your inspiration was

 

CALCULATETABLE(CROSSJOIN(DISTINCT([Date(Month)]),DISTINCT([Job Order])),Filter)

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.