Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi there,
I have the need above in the topi title, so for example, if this is my database:
Machine | Date | Kg |
M1 | 01/03/2022 | 823 |
M1 | 15/05/2022 | 186 |
M1 | 10/04/2022 | 591 |
M2 | 25/06/2022 | 173 |
M2 | 13/03/2022 | 226 |
M2 | 15/07/2022 | 949 |
M3 | 16/08/2022 | 969 |
M3 | 17/10/2022 | 761 |
M3 | 13/09/2022 | 447 |
The result that i'm trying to reach is this:
Machine | Date | Kg |
M1 | 01/03/2022 | 823 |
M2 | 15/07/2022 | 949 |
M3 | 16/08/2022 | 969 |
Actually, i've tried in two ways:
1) with a report filter, putting a "prime N" filter on date, order by Kg produced. But this doesn't work because it finds the day with the max unit produced for all the machines and then the report finds the production for that day for each machine.
2) with a DAX formula:
CALCULATE(MAX(Table1[Date]),ALLEXCEPT(Table1,Table1[Kg]))
but simply that formula is not correct somewhere.
Some suggestions? 🙂
Thanks.
Solved! Go to Solution.
@andreazambon Hi!
You have to calculate the measure:
@andreazambon ok, allora questa la formula:
BBF
Also, i found that 'kg buoni' is itself a formula... probably this is the issue.
can you use this as a sample?
Data Produzione | Ordine Cliente | Centro di Lavoro | Causa Scarto | Codice Cliente | Codice Materiale | Stato | Tipo | Turno | Operatore | kg buoni col | m buoni col | kg versati stato AM |
######## | 60001745 | 9002 | 201851 | 5,19E+09 | M | 0 | 1234999 | 474 | ||||
######## | 60001714 | 9002 | 201851 | 5,19E+09 | M | 0 | 1234999 | 420 | ||||
######## | 20019773 | 9002 | 201371 | 5,14E+09 | M | 0 | 1234999 | 284 | ||||
######## | 60001689 | 9002 | 201514 | 5,15E+09 | M | 0 | 1234999 | 470 | ||||
######## | 20021164 | 9002 | 201514 | 5,15E+09 | M | 0 | 1234999 | 552 | ||||
######## | 20020524 | 9002 | 200686 | 5,07E+09 | M | 0 | 1234999 | 346 | ||||
######## | (vuoto) | 9001 | (vuoto) | 50 | M | 0 | 1234999 | 1.871 | ||||
######## | (vuoto) | 9001 | (vuoto) | 50 | M | 0 | 1234999 | 546 | ||||
######## | 20021617 | 9001 | 208180 | 5,82E+09 | M | 0 | 1234999 | 546 | ||||
######## | 20024320 | 9001 | 201664 | 5,16E+09 | M | 0 | 1234999 | 775 | ||||
######## | (vuoto) | 9001 | (vuoto) | 50 | M | 0 | 1234999 | 748 | ||||
######## | 80002789 | 9001 | 106711 | 5,67E+09 | M | 0 | 1234999 | 116 | ||||
######## | 80002790 | 9001 | 106711 | 5,67E+09 | M | 0 | 1234999 | 126 | ||||
######## | 80002791 | 9001 | 106711 | 5,67E+09 | M | 0 | 1234999 | 118 | ||||
######## | 20023873 | 9001 | 201918 | 5,19E+09 | M | 0 | 1234999 | 655 |
formula for kg buoni:
@andreazambon the arranged formula:
Seems that is not working.
Your measure give me different day for each machine, but it's not the date where i have the MAX production.
For example, with "Centro di Lavoro" = 2016 (named CAST 😎 the day with the max production is 08/03/2022, your formula gave me 21/03/2022.
I'm sorry but i cant show you the correct data about the kg produced
Including your measure in my report, I see this, with wrong numbers:
'Impianto' is given by another table linked to zbob_tot via "centro di lavoro". (Impianto is the name of centro di lavoro).
Consider that in a day I can produce from 10.000 to 40.000 kg
Now, that sum of kg seems to be the production of 6 months of work, if it can help.
@andreazambon italiano?
Ripartiamo sui dati reali, perchè abbiamo fatto un po' di confusione. Dato il seguente dataset:
Data ProduzioneOrdine ClienteCentro di LavoroCausa ScartoCodice ClienteCodice MaterialeStatoTipoTurnoOperatorekg buoni colm buoni colkg versati stato AM
giovedì 12 agosto 2021 | 60001745 | 9002 | 201851 | 5190000000 | M | 0 | 1234999 | 474 | ||||
lunedì 12 settembre 2022 | 60001714 | 9002 | 201851 | 5190000000 | M | 0 | 1234999 | 420 | ||||
venerdì 13 luglio 2018 | 20019773 | 9002 | 201371 | 5140000000 | M | 0 | 1234999 | 284 | ||||
venerdì 13 luglio 2018 | 60001689 | 9002 | 201514 | 5150000000 | M | 0 | 1234999 | 470 | ||||
venerdì 13 luglio 2018 | 20021164 | 9002 | 201514 | 5150000000 | M | 0 | 1234999 | 552 | ||||
venerdì 13 luglio 2018 | 20020524 | 9002 | 200686 | 5070000000 | M | 0 | 1234999 | 346 | ||||
lunedì 13 maggio 2019 | (vuoto) | 9001 | (vuoto) | 50 | M | 0 | 1234999 | 1871 | ||||
lunedì 23 aprile 2018 | (vuoto) | 9001 | (vuoto) | 50 | M | 0 | 1234999 | 546 | ||||
martedì 17 novembre 2020 | 20021617 | 9001 | 208180 | 5820000000 | M | 0 | 1234999 | 546 | ||||
venerdì 13 luglio 2018 | 20024320 | 9001 | 201664 | 5160000000 | M | 0 | 1234999 | 775 | ||||
venerdì 13 luglio 2018 | (vuoto) | 9001 | (vuoto) | 50 | M | 0 | 1234999 | 748 | ||||
venerdì 13 luglio 2018 | 80002789 | 9001 | 106711 | 5670000000 | M | 0 | 1234999 | 116 | ||||
lunedì 13 luglio 2020 | 80002790 | 9001 | 106711 | 5670000000 | M | 0 | 1234999 | 126 | ||||
martedì 13 luglio 2021 | 80002791 | 9001 | 106711 | 5670000000 | M | 0 | 1234999 | 118 | ||||
venerdì 13 luglio 2018 | 20023873 | 9001 | 201918 | 5190000000 | M | 0 | 1234999 |
655 |
potresti dirmi qual è l'output desiderato?
BBF
Premesso che deve valere la formula della misura "kg buoni", dato quel dataset, il risultato desiderato è il seguente:
Data | Cdl | Kg |
venerdì 13 luglio 2018 | 9002 | 552 |
lunedì 13 maggio 2019 | 9001 | 1871 |
In pratica, per ogni macchina mi devi dire in quale data ho ottenuto la produzione più alta, e se voglio, anche quanto ho prodotto.
@andreazambon ok, allora questa la formula:
BBF
stesso problema di prima. Sospetto che il problema sia nel RETURN: calcolare il MAX di kg versati stato AM, senza filtrarlo, potrebbe non corrispondere a max di kg_buoni
nel mio dataset originale, purtroppo i dati non battono, nel senso che la tua formula mi da un risultato ma se "spulcio" i dati, trovo una tupla per lo stesso cdl con una produzione maggiore.
Tuttavia, se hai fatto dei test e la formula funziona, molto probabilmente è il dataset mio ad avere un filtraggio particolare, e li ci facciamo poco.
Riesci a condividere il pbix? così lavoro sul tuo stesso dataset
Vorrei, ma purtroppo contiene molti dati sensibili che per ragioni ovvie non posso condividere.
Ritengo comunque la mia richiesta soddisfatta, tieni presente che sono nuovo in questa azienda e non conosco a menadito il dataset. Se i test hanno confermato la validità della cosa, direi che possiamo fermarci.
Ti ringrazio per avermi seguito 🙂
you have it below the table
Hi,
Please check the below picture and the attached pbix file.
It is for creating a measure.
Date with Max KG measure: =
VAR _maxkg =
MAX ( Data[Kg] )
RETURN
IF (
HASONEVALUE ( Data[Machine] ),
CALCULATE ( MAX ( Data[Date] ), Data[Kg] = _maxkg )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
@andreazambon Hi!
You have to calculate the measure:
Hi,
adapting my real table, i've got this:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
49 | |
26 | |
20 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
43 | |
19 | |
18 |