Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello, I hope some help about this.
I managed to get the follwing graph
For this, I first created a column in ventas table with this Dax formula:
(This column is only a count of total sales or total ids in each month)
My problem comes because in this way, my measure is "static" and I need to be able to change it in base a slicer that have the segment column of segmentos table.
So I tried to put a single masure like this (using ALLSELECTED function), but I get error with EARLIER function (and I'm not really sure if this will give me the desire output that could be filtered with segment slicer)
I hope my explanation is enough and someone could give some help. Feel free to ask more details if necessary.
Solved! Go to Solution.
Yes, I tried the column you suggested, I even tried that before posting
But, finally I managed to get what I needed. Here the metric:
Hi @Anonymous ,
I would suggest you first create a column in your ventas table using below syntax:
Year-month=FORMAT(ventas[date], "yyyymm")
Then create a measure as below:
Venta Mens. Cosecha =
var Venta_Mens. = CALCULATE (
COUNT(ventas[id]),
FILTER(ALLSELECTED(ventas),ventas[Year-month] = MAX(ventas[Year-month]))
return
CALCULATE (
MAX(Venta_Mens.),
USERELATIONSHIP(ventas[date], trx_diario[dia_venta])
)
Best Regards,
Kelly
Did I answer your question? Mark my reply as a solution!
Hello, sorry for delay, but this is the same as @amitchandak answer and as I said before, I get error in MAX function (you can see it in the next image). I still don't get how to fix it.
Hi @Anonymous ,
Have you first created a column as I suggested before?
Year-month=FORMAT(ventas[date], "yyyymm")
If you still get errors,would you pls provide some dummy data for test?
Best Regards,
Kelly
Did I answer your question? Mark my reply as a solution!
Yes, I tried the column you suggested, I even tried that before posting
But, finally I managed to get what I needed. Here the metric:
@Anonymous , You can use allselected and MAx in place earlier in a measure
Venta Mens. Cosecha =
var Venta_Mens. = CALCULATE (
COUNT(ventas[id]),
FILTER(ALLSELECTED(ventas), FORMAT(ventas[date], "yyyymm") = FORMAT(MAX(ventas[date]), "yyyymm") ))
return
CALCULATE (
MAX(Venta_Mens.),
USERELATIONSHIP(ventas[date], trx_diario[dia_venta])
)
what are you trying to do here.
if you need last month data use time intelligence
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
@amitchandak Thanks for your suggestion.
I have to say that searching about EARLIER function I found what you say (replacing EARLIER by MAX), but the problem it that using the formula you suggest gives me error "The MAX function only accepts a column reference as an argument." (But this function is what I need, problem is the given error)
I don't get how to solve this error because as I understand so far, I only passing one argument to MAX function, but get error anyway.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
70 | |
68 | |
43 | |
34 | |
26 |
User | Count |
---|---|
86 | |
50 | |
45 | |
38 | |
38 |