The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am trying to get the participation of the current date products within the total amount of three months ago. The sum of these is correct (604040) but I want the actual products total (273158).
I hope you could help with this.
Thanks.
Hi, @ZaheenHamidani
You may try the following measure to see if it works.
x =
VAR tab =
SUMMARIZE (
BD,
BD[MARCA],
BD[ARTICULO],
"Result",
VAR MAXDATE =
MAX ( BD[FECHA] )
VAR EndYear =
YEAR ( LASTDATE ( BD[FECHA] ) )
VAR EndMonth =
MONTH ( LASTDATE ( BD[FECHA] ) )
VAR Monto =
CALCULATE (
SUM ( BD[MONTO] ),
FILTER ( BD, YEAR ( BD[FECHA] ) = EndYear && MONTH ( BD[FECHA] ) = EndMonth )
)
VAR TRESTABLE =
CALCULATETABLE (
BD,
DATESINPERIOD ( BD[FECHA], EOMONTH ( MAXDATE, -1 ), -3, MONTH )
)
RETURN
SUMX ( TRESTABLE, IF ( ISBLANK ( Monto ), BLANK (), BD[MONTO] ) )
)
RETURN
SUMX ( tab, [Result] )
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@ZaheenHamidani I don't see the 273158 in your screenshot - what is 'actual products' mean? Can you please define this?
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
If I download the table it will give the sum 273158 and 45.22%. When I say "actual products" I mean the products that I sold the filtered month.
January:
A21: 13
A24: 15
A27: 10
February:
B15: 45
B13: 56
A21: 34
March
A37: 34
A23: 45
B12: 34
C11: 45
April:
A23: 45
B12: 34
B15: 56
A24: 23
A21: 34
I need the three months before April to sum but let just the products that are in April:
A23: 45
B12: 34
B15: 45
A24: 15
A21: (34+13) = 47
Hi,
Your question is still not clear. Share the link from where i can download your PBI file and show the expected result there clearly. Please also ensure that the language in the PBI file is Engligh or else please clealry let me know the transaltion of the relevant columns.