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
NadaBen
Helper I
Helper I

if all

I  have a measure : "rupture" which is calculated (substraction) based on two other measures "Stock Week " and stock  Week-1. 

I have good results when i'm in a weekly bucket, but when i'm in total, it gives me the result based on the total of "Stock Week " and "stock Week-1".

 

I would like to sum the "rupture "  of the weekly buckets when  i'm in All(week).

Capture123.PNG

Thanks in advance.

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @NadaBen,

 

If you add some specify filter in measure, it will return the wrong result at total row. In my opinion, you can add a condition to filter the total row and add the specify calculation on it.

 

For example:

 

Condition Calculate = 
var currRowLabel=LASTNONBLANK('Table'[Date].[Month],'Table'[Date].[Month])
var currColumnLabel=MAX('Table'[Date].[Year])
return
if(COUNTROWS('Table')=COUNTROWS(ALL('Table')),
	"all",//all
	if(COUNTROWS('Table')=COUNTROWS(FILTER(ALL('Table'),[Date].[Month]=currRowLabel)),
		"row",//row
		if(COUNTROWS('Table')=COUNTROWS(FILTER(ALL('Table'),[Date].[Year]=currColumnLabel)),
			"column",//column
			SUM('Table'[Amount]))))

 

Capture.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @NadaBen,

 

If you add some specify filter in measure, it will return the wrong result at total row. In my opinion, you can add a condition to filter the total row and add the specify calculation on it.

 

For example:

 

Condition Calculate = 
var currRowLabel=LASTNONBLANK('Table'[Date].[Month],'Table'[Date].[Month])
var currColumnLabel=MAX('Table'[Date].[Year])
return
if(COUNTROWS('Table')=COUNTROWS(ALL('Table')),
	"all",//all
	if(COUNTROWS('Table')=COUNTROWS(FILTER(ALL('Table'),[Date].[Month]=currRowLabel)),
		"row",//row
		if(COUNTROWS('Table')=COUNTROWS(FILTER(ALL('Table'),[Date].[Year]=currColumnLabel)),
			"column",//column
			SUM('Table'[Amount]))))

 

Capture.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Many Thanks 

NadaBen
Helper I
Helper I

Any help would be appreciated 🙂

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.