D11: Customer w highest lifespan | #25daysofdaxfridays challenge

preview_player
Показать описание
Check the rules of the challenge here:

Part of the thumbnail uses an image "Designed by Freepik"

Join this channel membership to get access to all the recorded bites as they become available:

SUBSCRIBE to learn more about Power and Excel BI!

Our PLAYLISTS:

☼☼☼☼☼☼☼☼☼☼

POWER BI COURSES:

Want to learn Power BI? How about you take one of our courses? Here you can find the available courses:

☼☼☼☼☼☼☼☼☼☼

ABOUT CURBAL:

QUESTIONS? COMMENTS? SUGGESTIONS? You’ll find me here:
Twitter ► @curbalen

#CURBAL #SUBSCRIBE
Рекомендации по теме
Комментарии
Автор

Nice, I used firstdate and lastdate instead of min and max, don’t know it came first to my mind 😀

chahineatallah
Автор

A bit late in joining the 25 day challenge, but here's the DAX I implemented. Very similar but broken out into more variables to keep myself thought process straight

VAR _tbl =
SUMMARIZECOLUMNS (
Customers[CustomerID]
, Customers[CompanyName]
, VAR _ID = SELECTEDVALUE ( Customers[CustomerID] )
VAR _minDate =
MINX (
FILTER (
( Orders )
ORDERS[CustomerID] = _ID
)
, Orders[OrderDate]
)
VAR _maxDate =
MAXX (
FILTER (
( Orders )
ORDERS[CustomerID] = _ID
)
, Orders[OrderDate]
)
RETURN
DATEDIFF ( _minDate, _maxDate, DAY )
)
VAR _filter =
TOPN (
1
, _tbl
)
VAR _result =
SELECTCOLUMNS (
_filter
, "CUSTOMER"
, 'Customers'[CompanyName]
)

RETURN
_result

ElevatedBI