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
Anonymous
Not applicable

Summarize ranked sales

Hi Community!

 

I'm having trouble trying to perform a measure. I need tu summarize sales with sepecific conditions. The conditions are: Sum sales that are more or equal than 1 million and that the sales rank is above 30.

 

The measure that I imagine is something like this:

Ventas Marcas Emergentes +1M = 
CALCULATE(
    'Medidas VentasMPh'[Ventas];
    GROUPBY(
        'Marca';
        'Marca'[Leading Brands]
    );
    FILTER(
        'Medidas VentasMPh';
        'Medidas VentasMPh'[Ventas] >= 1000000
    );
    FILTER(
        'Medidas VentasMPh';
        'Medidas VentasMPh'[Ranking Leading Brand por Ventas] > 30
    )
)

What I notice is the second filter of the rank is not working.

 

The rank measure is:

Ranking Leading Brand por Ventas = 
/* Se rankea Leading Brand por la medida de Ventas (responde al selector de período YTD,MTH,MAT) */

IF(
	'Medidas VentasMPh'[Ventas] <> 0;
	RANKX(
		ALLSELECTED('Marca'[Leading Brands]);
		'Medidas VentasMPh'[Ventas]
	)
)

This rank measure works fine when using in a table with Leading Brands.

 

What should I change to make this work?

 

Thanks in advance.

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

Can you share a dummy sample? 

How about function Summarize? Is [Ventas] a measure or a column?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-jiascu-msft.

 

[Ventas] is a measure:

Ventas = 
SWITCH(
	VALUES(
		'Selector Período'[Período]
	);
	"YTD";
	CALCULATE(
		SUM(
			'Ventas Mensuales'[USD]
		);
		DATESYTD(
			'Período a Analizar'[Fecha]
		);
        USERELATIONSHIP(
            'Producto Compañía'[IdCompania-IdProductoCompania];
            'Ventas Mensuales'[IdCompania-IdProductoCompania]
        )
	);
	"MTH";
    CALCULATE(
        SUM(
            'Ventas Mensuales'[USD]
        );
        USERELATIONSHIP(
            'Producto Compañía'[IdCompania-IdProductoCompania];
            'Ventas Mensuales'[IdCompania-IdProductoCompania]
        )
    );
	"MAT";
	CALCULATE(
		SUM(
			'Ventas Mensuales'[USD]
		);
		DATESINPERIOD(
			'Período a Analizar'[Fecha];
			LASTDATE(
				'Período a Analizar'[Fecha]
			);
			-1;
			YEAR
		);
        USERELATIONSHIP(
            'Producto Compañía'[IdCompania-IdProductoCompania];
            'Ventas Mensuales'[IdCompania-IdProductoCompania]
        )
	)
)

 

Does this help to clarify the situation?

 

Thanks in advance.

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.