Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Power BI folks
Looking for some help with the DAX measure named YTD that will be used for table visualization. YTD must show a cumulative sum based on purchase volume to customers. I partially created the DAX which needs some further tweaking.
Cumulative YTD Actual Volume = calculate (SUM(Actual[SALESQYT]*10), DATESYTD('Date'[Date])), but I need to include one more criteria in this DAX measure i.e. for customer A and C the Sales Volume to be multiplied by 20. Sample of the desired data is shown the following table.
DATASETS
Customer | Quantity | Date | Mon_Num |
A | 86 | 10/01/2020 | 1 |
B | 64 | 01/01/2020 | 1 |
D | 61 | 23/02/2019 | 2 |
A | 51 | 14/02/2019 | 2 |
A | 61 | 05/02/2019 | 2 |
D | 66 | 26/03/2019 | 3 |
B | 91 | 17/01/2019 | 1 |
B | 64 | 08/01/2019 | 1 |
C | 63 | 30/04/2020 | 4 |
C | 94 | 21/04/2020 | 4 |
D | 74 | 12/04/2020 | 4 |
C | 43 | 03/04/2020 | 4 |
A | 73 | 24/03/2020 | 3 |
B | 43 | 15/01/2020 | 1 |
FINAL OUTPUTS
Customer | Sum of Quantity | Criteria for DAX |
A | 5420 | multiplied by 20 |
B | 2620 | |
C | 4000 | multiplied by 20 |
D | 2010 |
Can anyone help me in completing the DAX the measure to get the below-desired outputs
As shown in the sample data set and the final output.
@Anonymous
Cumulative YTD Actual Volume =
CALCULATE (
SUMX (
MyTable,
IF (
MyTable[Customer ]
IN {
"A",
"C"
},
MyTable[Quantity] * 20,
MyTable[Quantity] * 10
)
),
FILTER (
ALL ( 'MyTable'[Date].[Date] ),
'MyTable'[Date].[Date]
<= MAX ( 'MyTable'[Date].[Date] )
)
)
//If you are not using the Date Hierarchy then you can remove .[Date] from the above part ('MyTable'[Date].[Date])
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
Thanks @nandukrishnavs for your inputs. I managed to get the solution fixed, sorry for nicking your DAX a bit and merged with my earlier measure it is perfectly working now. The final DAX measure -
Hi @Anonymous ,
You can try these measures. Not sure why YTD.
Thanks @harshnathani for your contribution - The DAX measure output was to calculate Cumulative Sum.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |