Forum Discussion
Anonymous
5 years agoNot 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:
| Date | Full Plate Number | Month |
| 1/1/2021 | Job Order 1 | Jan |
| 1/1/2021 | Job Order 2 | Jan |
| 1/1/2021 | Job Order 3 | Jan |
| 1/1/2021 | Job Order 4 | Jan |
| 1/2/2021 | Job Order 3 | Jan |
| 1/2/2021 | Job Order 4 | Jan |
| 1/2/2021 | Job Order 5 | Jan |
| 1/2/2021 | Job Order 6 | Jan |
| 2/1/2021 | Job Order 5 | Feb |
| 2/1/2021 | Job Order 6 | Feb |
| 2/1/2021 | Job Order 7 | Feb |
| 2/1/2021 | Job Order 8 | Feb |
| 2/2/2021 | Job Order 7 | Feb |
| 2/2/2021 | Job Order 8 | Feb |
| 2/2/2021 | Job Order 9 | Feb |
| 2/2/2021 | Job Order 10 | Feb |
| 2/2/2021 | Job Order 11 | Feb |
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:
| Month | Distinct Item of that month |
| Jan | Job Order 1 |
| Jan | Job Order 2 |
| Jan | Job Order 3 |
| Jan | Job Order 4 |
| Jan | Job Order 5 |
| Jan | Job Order 6 |
| Feb | Job Order 5 |
| Feb | Job Order 6 |
| Feb | Job Order 7 |
| Feb | Job Order 8 |
| Feb | Job Order 9 |
| Feb | Job Order 10 |
| Feb | Job 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] ))
- Anonymous5 years ago
amitchandak what ended up working thanks to your inspiration was
CALCULATETABLE(CROSSJOIN(DISTINCT([Date(Month)]),DISTINCT([Job Order])),Filter)
3 Replies
- amitchandakSuper 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])
- AnonymousNot applicable
amitchandak that is giving me all the months I only want the months that exist
- AnonymousNot applicable
amitchandak what ended up working thanks to your inspiration was
CALCULATETABLE(CROSSJOIN(DISTINCT([Date(Month)]),DISTINCT([Job Order])),Filter)