Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
davidesottura
Regular Visitor

Dos filtros fecha en matriz

Hola Buenas tardes.

 

Me gustaria saber como poner dos filtros de fechas para una matriz, dejo un ejemplo 

Tabla

IDFechaConceptoImporte1Improte2Improte3
12020-01-01 00:00:00Concepto14929.753943.8985.95
22019-03-01 00:00:00Concepto26240.74992.561248.14
32019-01-01 00:00:00Concepto38327.586662.0641665.516
42020-01-01 00:00:00Concepto410915.658732.522183.13
52020-02-01 00:00:00Concepto58660.456928.361732.09
62019-01-01 00:00:00Concepto63863.393090.712772.678
12019-09-01 00:00:00Concepto14029.283223.424805.856
22019-09-01 00:00:00Concepto21809.141447.312361.828
32019-05-01 00:00:00Concepto34994.93995.92998.98
42019-06-01 00:00:00Concepto41474.281179.424294.856
52019-10-01 00:00:00Concepto51492.321193.856298.464
62019-01-01 00:00:00Concepto6454.42363.53690.884
12019-06-01 00:00:00Concepto12767.62214.08553.52
22020-01-01 00:00:00Concepto215773.5912618.8723154.718
32019-10-01 00:00:00Concepto312749.2610199.4082549.852
42020-02-01 00:00:00Concepto46365.055092.041273.01
52019-04-01 00:00:00Concepto55674.484539.5841134.896
62019-04-01 00:00:00Concepto62767.62214.08553.52
 
 

 

Enemplo de informe

 

        
  DelAl    
 Rango Fecha 101/02/202029/02/2020    
 Rango Fecha 201/01/202031/01/2020    
        
  Rango Fechas 1Rango Fechas 2
IDConceptoImporte1Improte2Improte3Importe1Improte2Improte3
1Concepto1121312   
2Concepto2141514   
3Concepto3161716   
4Concepto4181918   
5Concepto5202020   
6Concepto6222422   
 Total102108102000

 

 

Espero me puedan ayudar pero espero que sea claro al pedir ayuda con esto.

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @davidesottura ,

 

Please check:

 

1. In Power Query Editor, unpivot columns.

unpivot.gif

 

In Power BI Desktop,

 

2. Create two Dates Tables.

Dates1 = CALENDAR ( MIN ( 'Table'[Fecha] ), MAX ( 'Table'[Fecha] ) )
Dates2 = CALENDAR ( MIN ( 'Table'[Fecha] ), MAX ( 'Table'[Fecha] ) )

 

3. Enter data.

Rango Fechas table:

rango fechas.PNG

 

4. Create one Measure.

Rango Values = 
VAR Rango_Fechas_1_Del =
    MINX ( VALUES ( Dates1[Date] ), [Date] )
VAR Rango_Fechas_1_Al =
    MAXX ( VALUES ( Dates1[Date] ), [Date] )
VAR Rango1 =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            'Table',
            'Table'[Fecha] >= Rango_Fechas_1_Del
                && 'Table'[Fecha] <= Rango_Fechas_1_Al
        )
    )
VAR Rango_Fechas_2_Del =
    MINX ( VALUES ( Dates2[Date] ), [Date] )
VAR Rango_Fechas_2_Al =
    MAXX ( VALUES ( Dates2[Date] ), [Date] )
VAR Rango2 =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            'Table',
            'Table'[Fecha] >= Rango_Fechas_2_Del
                && 'Table'[Fecha] <= Rango_Fechas_2_Al
        )
    )
RETURN
    SWITCH (
        MAX ( 'Rango Fechas'[Rango Fechas] ),
        "Rango Fechas 1", Rango1,
        "Rango Fechas 2", Rango2
    )

 

5. Create two Date Slicers.

dates1.PNG

dates2.PNG

 

6. Create a Matrix visual.

matrix visual 2.PNG

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Icey
Community Support
Community Support

Hi @davidesottura ,

 

Is this problem solved?

 

 

Best Regards,

Icey

@Icey  buenos dias, Te agradezco mucho por la ayuda.
Soy nuevo en PWBI

Me podrias ayudar con esto mismo ya que ahora en la misma tabla tengo que agregar en cada renglon un una diferencia esta seria 

Variación= importe 1 de rango 2 – importe 1 de rango 1

[importe1-Rango Fechas 2]-[importe1-Rango Fechas 1]

%Variación = ((importe 1 de rango 2 – importe 1 de rango 1)/  importe 1 de rango 1)]*100
([importe1-Rango Fechas 2]-[importe1-Rango Fechas 1])/[importe1-Rango Fechas 1])*100)

 

Algo asi, incluyendo los totales podrian sen mejor como una tarjeta.

 

  Rango Fechas 1Rango Fechas 2Variación
IDConceptoImporte1Improte2Improte3Importe1Improte2Improte3Variación%Variación
1Concepto112131230  18150%
2Concepto214151410  -4-29%
3Concepto31617168  -8-50%
4Concepto418191820  211%
5Concepto520202015  -5-25%
6Concepto622242220  -2-9%
 Total1021081021030011%

 

Por lo que he visto creo que tambien se trendria que realizar con una medida.


Espero me puedas ayudar y muchas Gracias

Hi @Icey  good nigth.

Tomorrow I will Check  your solution and I think that is correct, I will make my comments to you.

Icey, buenos dias, Te agradezco mucho por la ayuda.
Soy nuevo en PWBI

Me podrias ayudar con esto mismo ya que ahora en la misma tabla tengo que agregar en cada renglon un una diferencia esta seria 

Variación= importe 1 de rango 2 – importe 1 de rango 1

[importe1-Rango Fechas 2]-[importe1-Rango Fechas 1]

%Variación = ((importe 1 de rango 2 – importe 1 de rango 1)/  importe 1 de rango 1)]*100
([importe1-Rango Fechas 2]-[importe1-Rango Fechas 1])/[importe1-Rango Fechas 1])*100)

 

Algo asi, incluyendo los totales podrian sen mejor como una tarjeta.

 

  Rango Fechas 1Rango Fechas 2Variación
IDConceptoImporte1Improte2Improte3Importe1Improte2Improte3Variación%Variación
1Concepto112131230  18150%
2Concepto214151410  -4-29%
3Concepto31617168  -8-50%
4Concepto418191820  211%
5Concepto520202015  -5-25%
6Concepto622242220  -2-9%
 Total1021081021030011%

 

Por lo que he visto creo que tambien se trendria que realizar con una medida.


Espero me puedas ayudar y muchas Gracias

Icey
Community Support
Community Support

Hi @davidesottura ,

 

Please check:

 

1. In Power Query Editor, unpivot columns.

unpivot.gif

 

In Power BI Desktop,

 

2. Create two Dates Tables.

Dates1 = CALENDAR ( MIN ( 'Table'[Fecha] ), MAX ( 'Table'[Fecha] ) )
Dates2 = CALENDAR ( MIN ( 'Table'[Fecha] ), MAX ( 'Table'[Fecha] ) )

 

3. Enter data.

Rango Fechas table:

rango fechas.PNG

 

4. Create one Measure.

Rango Values = 
VAR Rango_Fechas_1_Del =
    MINX ( VALUES ( Dates1[Date] ), [Date] )
VAR Rango_Fechas_1_Al =
    MAXX ( VALUES ( Dates1[Date] ), [Date] )
VAR Rango1 =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            'Table',
            'Table'[Fecha] >= Rango_Fechas_1_Del
                && 'Table'[Fecha] <= Rango_Fechas_1_Al
        )
    )
VAR Rango_Fechas_2_Del =
    MINX ( VALUES ( Dates2[Date] ), [Date] )
VAR Rango_Fechas_2_Al =
    MAXX ( VALUES ( Dates2[Date] ), [Date] )
VAR Rango2 =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            'Table',
            'Table'[Fecha] >= Rango_Fechas_2_Del
                && 'Table'[Fecha] <= Rango_Fechas_2_Al
        )
    )
RETURN
    SWITCH (
        MAX ( 'Rango Fechas'[Rango Fechas] ),
        "Rango Fechas 1", Rango1,
        "Rango Fechas 2", Rango2
    )

 

5. Create two Date Slicers.

dates1.PNG

dates2.PNG

 

6. Create a Matrix visual.

matrix visual 2.PNG

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.