Forum Discussion
DAX formula
- Anonymous2 years ago
Hi V3Rn3r_8-6
Use measure instead of calculate column, pbix file attached.Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous2 years ago
Hi V3Rn3r_8-6
Please try the following calculate column:
Realllll = VAR _count = CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Name]=EARLIER('Table'[Name])&&'Table'[Date]=EARLIER('Table'[Date]))) RETURN IF ( CALCULATE ( SUM ( 'Table'[Total Orders on shift] ), FILTER ( ALL ( 'Table' ), 'Table'[Name] = EARLIER('Table'[Name]) && 'Table'[Shift] = "O" &&'Table'[Date]=EARLIER('Table'[Date]) ) ) > CALCULATE ( SUM ( 'Table'[Total Orders on shift] ), FILTER ( ALL ( 'Table' ), 'Table'[Name] = EARLIER('Table'[Name]) && 'Table'[Shift] = "N" &&'Table'[Date]=EARLIER('Table'[Date]) ) ), _count&"x"&"O", IF ( CALCULATE ( SUM ( 'Table'[Total Orders on shift] ), FILTER ( ALL ( 'Table' ), 'Table'[Name] = EARLIER('Table'[Name]) && 'Table'[Shift] = "N" &&'Table'[Date]=EARLIER('Table'[Date]) ) ) > CALCULATE ( SUM ( 'Table'[Total Orders on shift] ), FILTER ( ALL ( 'Table' ), 'Table'[Name] = EARLIER('Table'[Name]) && 'Table'[Shift] = "R" &&'Table'[Date]=EARLIER('Table'[Date]) ) ), _count&"x"&"N", _count&"x"&"R" ) )Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi V3Rn3r_8-6
Please try the following calculate column:
Realllll =
VAR _count = CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Name]=EARLIER('Table'[Name])&&'Table'[Date]=EARLIER('Table'[Date])))
RETURN
IF (
CALCULATE (
SUM ( 'Table'[Total Orders on shift] ),
FILTER (
ALL ( 'Table' ),
'Table'[Name] = EARLIER('Table'[Name])
&& 'Table'[Shift] = "O" &&'Table'[Date]=EARLIER('Table'[Date])
)
)
> CALCULATE (
SUM ( 'Table'[Total Orders on shift] ),
FILTER (
ALL ( 'Table' ),
'Table'[Name] = EARLIER('Table'[Name])
&& 'Table'[Shift] = "N" &&'Table'[Date]=EARLIER('Table'[Date])
)
),
_count&"x"&"O",
IF (
CALCULATE (
SUM ( 'Table'[Total Orders on shift] ),
FILTER (
ALL ( 'Table' ),
'Table'[Name] = EARLIER('Table'[Name])
&& 'Table'[Shift] = "N" &&'Table'[Date]=EARLIER('Table'[Date])
)
)
> CALCULATE (
SUM ( 'Table'[Total Orders on shift] ),
FILTER (
ALL ( 'Table' ),
'Table'[Name] = EARLIER('Table'[Name])
&& 'Table'[Shift] = "R" &&'Table'[Date]=EARLIER('Table'[Date])
)
),
_count&"x"&"N",
_count&"x"&"R"
)
)
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
This is just what I needed, you're absolutely brilliant, thank you very much.
Great job, I'll be praising you everywhere.
Thank you very much again