The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I am looking to create a DAX formula to get the Total Sales of max date of each month for Scenario = "Actual", and Category = "Applicances".
Thanks!
Sample Data:
Date | Category | Scenario | Customer | Total Sales |
4/26/2013 | Bookcases | Plan | Adam Bellavance | 6548.5 |
4/26/2013 | Bookcases | Plan | Adam Bellavance | 2153.55 |
4/26/2013 | Appliances | Actual | Adam Bellavance | 2472.66 |
11/7/2014 | Tables | Plan | Adam Bellavance | 1516.84 |
11/7/2014 | Tables | Plan | Adam Bellavance | 2036.86 |
11/7/2014 | Tables | Actual | Adam Bellavance | 1565.12 |
11/26/2014 | Tables | Plan | Adam Bellavance | 1237.56 |
11/26/2014 | Appliances | Plan | Adam Bellavance | 548.56 |
11/26/2014 | Appliances | Actual | Adam Bellavance | 367.67 |
Required Output
4/26/2013 | Appliances | Actual | Adam Bellavance | 2472.66 |
11/26/2014 | Appliances | Actual | Adam Bellavance | 367.67 |
2840.33 |
Solved! Go to Solution.
Sum of Max Date for Each Month =
SUMX(
VALUES( DATA[Customer] ),
SUMX(
VALUES( DATA[Yr-Mth] ),
VAR __tr = TREATAS( { ( "Appliances", "Actual" ) }, DATA[Category], DATA[Scenario] )
VAR __max = CALCULATE( MAX( DATA[Date] ), KEEPFILTERS( __tr ), ALL( DATA[Date] ) )
RETURN
CALCULATE(
SUM( DATA[Total Sales] ),
KEEPFILTERS( DATA[Date] = __max ),
__tr
)
)
)
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
Sum of Max Date for Each Month =
SUMX(
VALUES( DATA[Customer] ),
SUMX(
VALUES( DATA[Yr-Mth] ),
VAR __tr = TREATAS( { ( "Appliances", "Actual" ) }, DATA[Category], DATA[Scenario] )
VAR __max = CALCULATE( MAX( DATA[Date] ), KEEPFILTERS( __tr ), ALL( DATA[Date] ) )
RETURN
CALCULATE(
SUM( DATA[Total Sales] ),
KEEPFILTERS( DATA[Date] = __max ),
__tr
)
)
)
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |