Forum Discussion
Asim
8 years agoHelper I
Count with specific conditions
Hello! Good day, I would like to know the count of my semi material number is material is getting change, if not then i want to have 0 in column or measure. I am using below mentioned dax formula ...
- 8 years ago
Try this calculated column
Column = VAR PreviousDate = CALCULATE ( MAX ( EventLog[Date] ), FILTER ( ALLEXCEPT ( EventLog, EventLog[Machine] ), EventLog[Event] = "setUp" && EventLog[Date] < EARLIER ( EventLog[Date] ) ) ) VAR PreviousMaterial = CALCULATE ( FIRSTNONBLANK ( EventLog[Semi.Mat.No.], 1 ), FILTER ( ALLEXCEPT ( EventLog, EventLog[Machine] ), EventLog[Event] = "setUp" && EventLog[Date] = PreviousDate ) ) RETURN IF ( EventLog[Semi.Mat.No.] = PreviousMaterial, 0, 1 ) - 8 years ago
- 8 years ago
Hi Asim
Try this MEASURE... I am not sure if it will speed up things
Setup Count Measure = VAR mytable = ADDCOLUMNS ( Eventlog, "Asim", VAR PreviousDate = CALCULATE ( MAX ( EventLog[Date] ), FILTER ( ALLEXCEPT ( EventLog, EventLog[Machine] ), EventLog[Event] = "setup" && EventLog[Date] < EARLIER ( EventLog[Date] ) ) ) VAR PreviousMaterial = CALCULATE ( FIRSTNONBLANK ( EventLog[Semi.Mat.No.], 1 ), FILTER ( ALLEXCEPT ( EventLog, EventLog[Machine] ), EventLog[Event] = "setup" && EventLog[Date] = PreviousDate ) ) RETURN IF ( EventLog[Semi.Mat.No.] = PreviousMaterial, BLANK (), 1 ) ) RETURN COUNTX ( FILTER ( mytable, [Asim] = 1 ), 1 )
Asim
8 years agoHelper I
Dear Zubair_Muhammad,
After putting new formula in measure i am getting below result which is not as per desire result.
In fact Calculated column is giving precise result but the problem is that its occupy huge memory which create problem when the data grow.
Please help!
Regards
Asim
Zubair_Muhammad
8 years agoCommunity Champion
Hi Asim
Try this MEASURE... I am not sure if it will speed up things
Setup Count Measure =
VAR mytable =
ADDCOLUMNS (
Eventlog,
"Asim",
VAR PreviousDate =
CALCULATE (
MAX ( EventLog[Date] ),
FILTER (
ALLEXCEPT ( EventLog, EventLog[Machine] ),
EventLog[Event] = "setup"
&& EventLog[Date] < EARLIER ( EventLog[Date] )
)
)
VAR PreviousMaterial =
CALCULATE (
FIRSTNONBLANK ( EventLog[Semi.Mat.No.], 1 ),
FILTER (
ALLEXCEPT ( EventLog, EventLog[Machine] ),
EventLog[Event] = "setup"
&& EventLog[Date] = PreviousDate
)
)
RETURN
IF ( EventLog[Semi.Mat.No.] = PreviousMaterial, BLANK (), 1 )
)
RETURN
COUNTX ( FILTER ( mytable, [Asim] = 1 ), 1 )- Asim8 years agoHelper I
This measure is working perfect without any negative impact on speed or RAM.
thank you very much for your help
regards
Asim