The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have 1 Fact table and 1 Date table. I would like 2 new metrics.
Earliest week of =
Latest week of =
Both metrics should be based on the orders in the Fact table, not the Date table. I'm still learning.
Thanks
Solved! Go to Solution.
Try these measures:
Earliest Week Of =
VAR vMinFactDate =
CALCULATE ( MIN ( 'FACT'[DATE] ), ALL ( 'FACT' ) )
VAR vTable =
FILTER ( ALL ( 'DATE' ), 'DATE'[DATE] = vMinFactDate )
VAR vResult =
MAXX ( vTable, 'DATE'[WEEK OF] )
RETURN
vResult
Latest Week Of =
VAR vMaxFactDate =
CALCULATE ( MAX ( 'FACT'[DATE] ), ALL ( 'FACT' ) )
VAR vTable =
FILTER ( ALL ( 'DATE' ), 'DATE'[DATE] = vMaxFactDate )
VAR vResult =
MAXX ( vTable, 'DATE'[WEEK OF] )
RETURN
vResult
Proud to be a Super User!
Try these measures:
Earliest Week Of =
VAR vMinFactDate =
CALCULATE ( MIN ( 'FACT'[DATE] ), ALL ( 'FACT' ) )
VAR vTable =
FILTER ( ALL ( 'DATE' ), 'DATE'[DATE] = vMinFactDate )
VAR vResult =
MAXX ( vTable, 'DATE'[WEEK OF] )
RETURN
vResult
Latest Week Of =
VAR vMaxFactDate =
CALCULATE ( MAX ( 'FACT'[DATE] ), ALL ( 'FACT' ) )
VAR vTable =
FILTER ( ALL ( 'DATE' ), 'DATE'[DATE] = vMaxFactDate )
VAR vResult =
MAXX ( vTable, 'DATE'[WEEK OF] )
RETURN
vResult
Proud to be a Super User!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
79 | |
72 | |
48 | |
39 |
User | Count |
---|---|
138 | |
108 | |
69 | |
64 | |
57 |