The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
My data looks like this..
PRDT | REG | DAT1 | DAT2 | DAT3 | DAT4 | QTY |
P1 | US | 8/9/2018 | 12/9/2017 | 1/12/2019 | 10/31/2017 | 100 |
P2 | EU | 3/9/2018 | 8/29/2017 | 9/9/2018 | 4/8/2017 | 200 |
P3 | US | 10/1/2018 | 3/7/2017 | 6/22/2018 | 3/17/2017 | 3400 |
P4 | ME | 12/20/2018 | 9/5/2017 | 1/10/2018 | 11/14/2017 | 400 |
P1 | EU | 6/19/2018 | 7/27/2017 | 1/23/2018 | 8/15/2018 | 500 |
I am looking for an output like this
PRDT | REG | MAXDATE | QTY |
P1 | US | 1/12/2019 | 100 |
P2 | EU | 9/9/2018 | 200 |
P3 | US | 10/1/2018 | 3400 |
P4 | ME | 12/20/2018 | 400 |
P1 | EU | 8/15/2018 | 500 |
in the powerquery to develop a powerBI dashboard.
My query looks like this [ including the 4 date fields in the ouput] . Tried couple of methods but none of them was successful.
select
MP."PRODT" "PRDT",
MP."AREA" "REG",
MP."EFFDT" "DAT1",
MP."APPDT" "DAT2",
MP."CONSDT" "DAT3",
MP."ENTDT" "DAT4",
(SELECT Max(v) FROM
VALUES ((MP."EFFDT"),( MP."APPDT"), (MP."CONSDT"),(MP."ENTDT")) Value(v)
)
"MaxDate",
MP."quan" "QTY"
from
"_SYS_BIC"."xxxxx" MP
where MP."AREA" IN ('xxx','yyy') and MP."quan" >0
@Anonymous
You can add a custom Column like
=List.Max({[DAT1],[DAT2],[DAT3],[DAT4]})
I tried the above option by adding a custom column, but it is not giving me the MAX Date on Each record.
Infact I was trying to avoid pulling in all these 4 date fields in the query output.
So if I am able to add the MAX Syntax in the power Query (SQL) itself it would be great.
User | Count |
---|---|
71 | |
62 | |
60 | |
49 | |
26 |
User | Count |
---|---|
117 | |
75 | |
62 | |
55 | |
43 |