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
Hi I am struggling with creating a calculated colum to show some data - i need it to be a calculated colum rather than a measure as I want to use the results in a map with conditional formatting.
here is the issue I have the following data
location | question category | date | score |
london | safety | 1/6/23 | 5 |
paris | data | 1/2/24 | 0 |
london | safety | 1/2/24 | 2 |
madrid | finance | 1/2/24 | 5 |
london | finance | 1/2/24 | 2 |
madrid | data | 1/6/23 | 5 |
paris | safety | 1/6/23 | 5 |
paris | safety | 1/2/24 | 5 |
madrid | data | 1/6/23 | 2 |
london | finance | 1/2/24 | 0 |
I want to create in a new table the summed score for each location for a particular category but i only want to use the data from the most recent date.
so far i have
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new table.
GROUPBY function (DAX) - DAX | Microsoft Learn
TREATAS function - DAX | Microsoft Learn
expected result table =
VAR _condition =
GROUPBY (
data,
data[location],
data[question category],
"@maxdate", MAXX ( CURRENTGROUP (), data[date] )
)
VAR _t =
CALCULATETABLE (
data,
TREATAS ( _condition, data[location], data[question category], data[date] )
)
RETURN
ADDCOLUMNS (
SUMMARIZE ( _t, data[location], data[question category], data[date] ),
"@ScoreSum", CALCULATE ( SUM ( data[score] ) )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
amazing this worked perfectly - thank you so much for your help
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new table.
GROUPBY function (DAX) - DAX | Microsoft Learn
TREATAS function - DAX | Microsoft Learn
expected result table =
VAR _condition =
GROUPBY (
data,
data[location],
data[question category],
"@maxdate", MAXX ( CURRENTGROUP (), data[date] )
)
VAR _t =
CALCULATETABLE (
data,
TREATAS ( _condition, data[location], data[question category], data[date] )
)
RETURN
ADDCOLUMNS (
SUMMARIZE ( _t, data[location], data[question category], data[date] ),
"@ScoreSum", CALCULATE ( SUM ( data[score] ) )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
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.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
20 | |
18 | |
18 | |
14 | |
13 |
User | Count |
---|---|
38 | |
31 | |
22 | |
20 | |
18 |