Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi guys,
I am new to power BI, and got a DAX problem.
I Have Historic data as below
[Historic Table]
GUID | Date | DeviceID | Alert
----------------------------------------------------
AAAAA | 3/27 | a | 1
BBBBB | 3/27 | a | 0
CCCCC | 3/27 | b | 0
DDDDD | 3/26 | a | 1
EEEEEE | 3/26 | a | 0
FFFFFF | 3/26 | b | 1
-----------------------------------------------------
And I want to create a new table called Device Summary which summarized the device ID and latest date , and Alert (If any is 1 in the same date , than 1) from the historic Data.
Just like the table below.
[Device Summary]
DeviceID | MAX Date | Alert
----------------------------------------------------
a | 3/27 | True
b | 3/27 | False
-----------------------------------------------------
So I use below DAX to create table,
DeviceSummary = (
SUMMARIZE(
Historic, Historic[DeviceID],
"MAX Date", MAX('Historic[Date]),
"Alert",IF(
CONTAINS('Historic','Historic[Alert],1),"True","False"
)
)
)
But I got the wrong result as below
DeviceID | MAX Date | Alert
----------------------------------------------------
a | 3/27 | True
b | 3/27 | True
-----------------------------------------------------
Looks like "CONTAINS" operator search all the data row in Historic Table, how can I use "Contains" with condition which just find data in latest date.
Solved! Go to Solution.
Hi @a-rychen ,
Please use following calculate table formula to create summary table:
Summary table = ADDCOLUMNS ( SUMMARIZE ( Table1, [DeviceID], "L Date", MAX ( Table1[Date] ) ), "Alert", COUNTROWS ( FILTER ( ALL ( table1 ), [DeviceID] = EARLIER ( [DeviceID] ) && [Date] = EARLIER ( [L Date] ) && [Alert] = 1 ) ) > 0 )
Regards,
Xiaoxin Sheng
Hi @a-rychen ,
Please use following calculate table formula to create summary table:
Summary table = ADDCOLUMNS ( SUMMARIZE ( Table1, [DeviceID], "L Date", MAX ( Table1[Date] ) ), "Alert", COUNTROWS ( FILTER ( ALL ( table1 ), [DeviceID] = EARLIER ( [DeviceID] ) && [Date] = EARLIER ( [L Date] ) && [Alert] = 1 ) ) > 0 )
Regards,
Xiaoxin Sheng
Hi, @Anonymous
It perfectly resolve my problem, Thank you.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
70 | |
68 | |
43 | |
34 | |
26 |
User | Count |
---|---|
86 | |
49 | |
45 | |
38 | |
37 |