Forum Discussion
Need help on DAX
- 4 years ago
Hi Srijit ,
According to your description, here's my solution.
1.Create a date column.
Date = FORMAT(DATE('Table'[Year],'Table'[Month Name],1),"yyyy-mm")2.Create a rank column based on date.
Rank = RANKX(FILTER(ALL('Table'),'Table'[Project Name]=MAX('Table'[Project Name])),'Table'[Date],,ASC,Dense)3.Create the count per month measure.
Count per Month = VAR _Cur = MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[Project Name] = MAX ( 'Table'[Project Name] ) && 'Table'[Rank] = MAX ( 'Table'[Rank] ) ), 'Table'[Total Count from start] ) VAR _Pre = MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[Project Name] = MAX ( 'Table'[Project Name] ) && 'Table'[Rank] = MAX ( 'Table'[Rank] ) - 1 ), 'Table'[Total Count from start] ) RETURN IF ( ISBLANK ( _Pre ), BLANK (), _Cur - _Pre )4.Create the count per qtr measure.
Count per Qtr = SUMX ( FILTER ( ALL ( 'Table' ), 'Table'[Project Name] = MAX ( 'Table'[Project Name] ) && 'Table'[QTR] = MAX ( 'Table'[QTR] ) ), [Count per Month] ) / 2Get the expected result.
As there isn't the start value here, so I show it blank.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Srijit ,
According to your description, here's my solution.
1.Create a date column.
Date = FORMAT(DATE('Table'[Year],'Table'[Month Name],1),"yyyy-mm")
2.Create a rank column based on date.
Rank = RANKX(FILTER(ALL('Table'),'Table'[Project Name]=MAX('Table'[Project Name])),'Table'[Date],,ASC,Dense)
3.Create the count per month measure.
Count per Month =
VAR _Cur =
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[Project Name] = MAX ( 'Table'[Project Name] )
&& 'Table'[Rank] = MAX ( 'Table'[Rank] )
),
'Table'[Total Count from start]
)
VAR _Pre =
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[Project Name] = MAX ( 'Table'[Project Name] )
&& 'Table'[Rank]
= MAX ( 'Table'[Rank] ) - 1
),
'Table'[Total Count from start]
)
RETURN
IF ( ISBLANK ( _Pre ), BLANK (), _Cur - _Pre )
4.Create the count per qtr measure.
Count per Qtr =
SUMX (
FILTER (
ALL ( 'Table' ),
'Table'[Project Name] = MAX ( 'Table'[Project Name] )
&& 'Table'[QTR] = MAX ( 'Table'[QTR] )
),
[Count per Month]
) / 2
Get the expected result.
As there isn't the start value here, so I show it blank.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.