Forum Discussion
SUMMARIZE DAX help needed
Hi thampton
It seems you import data into Power BI.
If so, assume [sale id] in Sales table and [sale id] in financials table have "many to one" relationship
In Sales table
Create calculated columns
year = YEAR('Sales table'[date])
month = MONTH('Sales table'[date])
Create measures
sales_monthly =
CALCULATE (
SUM ( 'Sales table'[sales] ),
FILTER (
ALLSELECTED ( 'Sales table' ),
'Sales table'[year] = MAX ( 'Sales table'[year] )
&& 'Sales table'[month] = MAX ( 'Sales table'[month] )
&& 'Sales table'[sales id] = MAX ( 'Sales table'[sales id] )
)
)
Max sales =
MAXX (
FILTER (
ALLSELECTED ( 'Sales table' ),
'Sales table'[sales id] = MAX ( 'Sales table'[sales id] )
&& 'Sales table'[year] = MAX ( 'Sales table'[year] )
),
[sales_monthly]
)
Best month =
CALCULATE (
MAX ( 'Sales table'[month] ),
FILTER (
ALLSELECTED ( 'Sales table' ),
'Sales table'[sales id] = MAX ( 'Sales table'[sales id] )
&& 'Sales table'[sales_monthly] = [Max sales]
)
)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- thampton7 years ago
Helper III
Thank you for the reply. If i want to write this dax as a calculated column (so i dont have to do the measures in PBI desktop). How would i configure that?
Currently i have a summary table like below and would just like to add it here...
Sales ID Total Financials (NEW COLUMNS)
1 100 Top Month DAX
2 200 Top Month DAX