Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
98 | |
97 | |
81 | |
77 | |
66 |
User | Count |
---|---|
126 | |
105 | |
103 | |
81 | |
72 |