Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hola, necesito calcular la suma de ventas para un período en especifico (solo un año) y que al graficar pueda tener el detalle de ventas por cada mes de ese año (2022) para graficar un grafico de líneas. En la BD tengo datos desde varios años y no puedo ocupar filtro de año pues necesito en esa misma gráfica otra línea con datos de 2023
adjunto ejemplo datos
Fecha | Ventas |
01-02-2021 | 350 |
03-03-2021 | 250 |
09-03-2021 | 200 |
28-05-2021 | 400 |
01-01-2022 | 200 |
02-03-2022 | 500 |
01-04-2022 | 200 |
31-05-2022 | 20 |
30-06-2022 | 200 |
29-08-2022 | 200 |
27-11-2022 | 580 |
27-12-2022 | 250 |
01-03-2023 | 500 |
01-01-2023 | 300 |
Solved! Go to Solution.
Hi @J3 ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create measures.
Sales 2022 = CALCULATE(SUM('Table'[Ventas]), YEAR('Table'[Fecha])=2022)
Sales 2023 = CALCULATE(SUM('Table'[Ventas]), FILTER(ALLSELECTED('Table'),YEAR('Table'[Fecha])=2023))
Flag = IF(YEAR(MAX('Table'[Fecha]))=2022 || YEAR(MAX('Table'[Fecha]))=2023,1,0)
(3) Then the result is as follows.
If the above one can't help you get the desired result, please give your expected output for the visual object. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @J3 ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create measures.
Sales 2022 = CALCULATE(SUM('Table'[Ventas]), YEAR('Table'[Fecha])=2022)
Sales 2023 = CALCULATE(SUM('Table'[Ventas]), FILTER(ALLSELECTED('Table'),YEAR('Table'[Fecha])=2023))
Flag = IF(YEAR(MAX('Table'[Fecha]))=2022 || YEAR(MAX('Table'[Fecha]))=2023,1,0)
(3) Then the result is as follows.
If the above one can't help you get the desired result, please give your expected output for the visual object. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
53 | |
28 | |
19 | |
18 | |
14 |
User | Count |
---|---|
92 | |
86 | |
39 | |
23 | |
22 |