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,
I have report wheer the user chooses a year and Month (Example March, 2024) via a filter. It displays Product and Sales for that Month. It also has a running total for the Sales from the start of time. All of this works.
Product | Sales | Total Sales |
Radio | 100 | 2,500 |
TV | 4,200 | 9,300 |
Toaster | 50 | 500 |
I have a card that shows the complete totals. It shows:
Sales: 4,350 | Total Sales: 9,300 |
Total Sales should show: 12,300.
The
Total Sales =
VAR SDt = SELECTEDVALUE ('DateTble'[Dt])
// Create a Running total of Sales by Product
VAR Result =
CALCULATE (
SUM ('SalesTable'[Loss Incurred]),
FILTER (ALL('SalesTable'), 'SalesTable'[AcctDt] <= SDt && 'SalesTable'[ProductID] = MAX ('SalesTable'[ProductID]))
)
RETURN Result
How do I get the correct overall total?
Hi @FPP ,
What does your data model look like, please describe it with relevant screenshot information.
Best Regards,
Adamk Kong
Thanks for the reply from @amitchandak , please allow me to provide another insight:
Hi @FPP ,
You can achieve a similar effect with the help of hasonevalue function. Refer to below formula:
TotalSales =
VAR SDt =
SELECTEDVALUE ( DateTable[Dt] )
VAR Result =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
ALL ( 'Table' ),
'Table'[Date] <= SDt
&& 'Table'[Product] = MAX ( 'Table'[Product] )
)
)
RETURN
IF (
HASONEVALUE ( 'Table'[Product] ),
Result,
SUMX ( FILTER ( ALL ( 'Table' ), 'Table'[Date] <= SDt ), [Sales] )
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, I do not know why but now my data is duplicating inside a different table visual.
This table has:
Product | Dt | Sales | Total Sales |
TV | March, 2024 | 4,200 | 9,300 |
TV | April, 2024 | 9,300 | |
etc. |
@FPP , Try like, measure should use date table in filter
Total Sales =
VAR SDt = SELECTEDVALUE ('DateTble'[Dt])
// Create a Running total of Sales by Product
VAR Result =
CALCULATE (
SUM ('SalesTable'[Loss Incurred]),
FILTER (ALL('DateTble'), 'DateTble'[Dt]] <= SDt )
)
Hi, This solution also duplicates my data inside a different table visual.
This table has:
Product | Dt | Sales | Total Sales |
TV | March, 2024 | 4,200 | 9,300 |
TV | April, 2024 | 9,300 | |
etc. |
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 |
---|---|
84 | |
75 | |
68 | |
41 | |
35 |
User | Count |
---|---|
102 | |
56 | |
52 | |
46 | |
40 |