Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
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.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 37 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 69 | |
| 67 | |
| 34 | |
| 33 | |
| 30 |