Forum Discussion
Product sample control
Hi Christianlekot ,
Here I will give you some suggestions on your code. According to your code, I think your code has a lot of duplicate parts that could be merged and simplified.
Krav prover =
ROUNDUP (
CALCULATE (
SUM ( 'Produktion'[Producerat antal] ) / 200,
'Datum TI slutmarkering'[Månad, siffra]
IN { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 },
ALL ( 'Datum TI slutmarkering'[Månad, siffra] )
),
0
)Status prov =
/*Code for "done tests" - "demanded tests"*/
ROUNDUP (
CALCULATE (
DISTINCTCOUNT ( 'Kvalitetsdatarapporter'[Product order number] ),
'Datum TI slutmarkering'[Månad, siffra]
IN { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 },
ALL ( 'Datum TI slutmarkering'[Månad, siffra] )
),
0
)
- ROUNDUP (
CALCULATE (
SUM ( 'Produktion'[Producerat antal] ) / 200,
'Datum TI slutmarkering'[Månad, siffra]
IN { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 },
ALL ( 'Datum TI slutmarkering'[Månad, siffra] )
),
0
)
I think 'Datum TI slutmarkering'[Månad, siffra] should be the month column. As far as I know, there should be only 12 months in a year, so I am confused why you add the filter like 'Datum TI slutmarkering'[Månad, siffra] IN { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } in your codes.
Is there something others like blank in [Månad, siffra]?
If this reply still couldn't help you solve your issue, please share a sample file with us. And you can show us a screenshot with the result you want. This will make us easier to find the solution.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Christianlekot2 years agoRegular Visitor
Hi Thanks for the respons.
The reason i created one "cycle" for every month is that i want to roundup so if the produced amount is less than 200 tonnes i a month there shall be atleast one test.
There is no blanks in the [Månad, siffra], it is just [months, by number]
Is there a smart way to set up this "monthly" control instead of calender month?
This is a sample what im looking for, a measure that creates the test analysis column.
Notes Date Test, analysis Produced amount First test 2024-01-26 1 50 2024-02-15 20 2024-02-22 15 new test analysis because more than 1 month since last test analysis 2024-02-30 1 10 2024-03-01 98 new test analysis because produced more than 200 tonnes since last test analysis. 2024-03-05 1 110 Sum 3 303