Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Dear all, i need your help on a tricky (tricky for me) dax question.
CONTEXT:
Following the Sales table :
ImpactedMonth SRK Sales EUR
| 202403 | 2 | 0,00 |
| 202403 | 1 | 19666,77 |
| 202404 | 3 | 12,40 |
| 202404 | 4 | 0,00 |
| 202404 | 11 | 0,00 |
| 202404 | 12 | 59037,50 |
| 202405 | 5 | 45,54 |
| 202405 | 6 | 0,00 |
| 202405 | 13 | 0,00 |
| 202405 | 14 | 136,63 |
| 202405 | 19 | 19724,71 |
| 202405 | 20 | 0,00 |
| 202406 | 16 | 147,02 |
| 202406 | 7 | 49,01 |
| 202406 | 8 | 0,00 |
| 202406 | 15 | 0,00 |
| 202406 | 21 | 49,01 |
| 202406 | 22 | 0,00 |
| 202406 | 25 | 43502,17 |
| 202406 | 26 | 0,00 |
| 202407 | 24 | 0,00 |
| 202407 | 10 | 0,00 |
| 202407 | 17 | 0,00 |
| 202407 | 18 | 91,90 |
| 202407 | 23 | 30,63 |
| 202407 | 9 | 30,63 |
| 202407 | 27 | 67,39 |
| 202407 | 28 | 0,00 |
| 202407 | 29 | 0,00 |
| 202407 | 30 | 19804,35 |
Using a table visual i want to display for each raw, the total sales of the period. To do so, i have a first measure that gives what i expect :
EXPECTED: I would like to obtain the same result with a measure based on a virtual table like the VAR _VirtualSalesTable below
In advance thank you for your help
Solved! Go to Solution.
Hi @BrunoM ,
Any result created when using a virtual table is intermediate and there is no way to directly “return” it, try the following expression:
TotalSalesByMonth =
VAR _VirtualSalesTable =
SELECTCOLUMNS(
Sales,
"ImpactedMonth", Sales[ImpactedMonth],
"SRK", Sales[SRK],
"SalesEUR", Sales[Sales EUR]
)
VAR _totalSales =
ADDCOLUMNS(
_VirtualSalesTable,
"Total", SUMX(
FILTER(
_VirtualSalesTable,
[ImpactedMonth] = EARLIER([ImpactedMonth])
),
[SalesEUR]
)
)
RETURN MAXX(_totalSales, [Total])
Best regards,
Community Support Team_ Scott Chang
Hi @BrunoM ,
I made simple samples and you can check the results below:
Measure = var _t = ADDCOLUMNS('Table',"Total",SUMX(FILTER(ALL('Table'),[ImpactedMonth]=EARLIER([ImpactedMonth])),[Sale EUR]))
RETURN MAXX(_t,[Total])
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
First of all, thanks to @Anonymous and @Jihwan_Kim for your answers. Unfortunatly, your solutions do not fit with my expectation and sorry if i was not enough clear in my description. Let me explain:
The measure i want to create must have this structure :
Hi @BrunoM ,
Any result created when using a virtual table is intermediate and there is no way to directly “return” it, try the following expression:
TotalSalesByMonth =
VAR _VirtualSalesTable =
SELECTCOLUMNS(
Sales,
"ImpactedMonth", Sales[ImpactedMonth],
"SRK", Sales[SRK],
"SalesEUR", Sales[Sales EUR]
)
VAR _totalSales =
ADDCOLUMNS(
_VirtualSalesTable,
"Total", SUMX(
FILTER(
_VirtualSalesTable,
[ImpactedMonth] = EARLIER([ImpactedMonth])
),
[SalesEUR]
)
)
RETURN MAXX(_totalSales, [Total])
Best regards,
Community Support Team_ Scott Chang
Hi,
Please try to write something like below.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 33 | |
| 31 | |
| 19 | |
| 12 | |
| 11 |