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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
terpilka
Helper I
Helper I

Exchange measures

Hi all, 

Could you help me, please,


Could you share your experience how I can realize the follow logic:
If I filter region=region2
When I create a pivot table in PowerBI  with filter I want to calculate:

for  "old" in indicator ="175"
FOR "new " in indicator ="45"

Please find the attachment as an example from Excel.

I try to solve it in the follow way:
DurationNew = if(VALUES('Project Tasks'[indicator])="ALL",CALCULATE(SUM('Project Tasks'[TaskDuration]),FILTER('Project Tasks','Project Tasks'[indicator]="old"),ALL('Project Tasks'[Region])),
CALCULATE(SUM('Project Tasks'[TaskDuration]),FILTER('Project Tasks','Project Tasks'[indicator]="new"),ALLselected('Project Tasks'[Region])))

But then I use filter in region, I have both of them filtered.
I need the table in this format, nobody don't use the column "indicator" as a filter.
regions.PNG
Many thanks, 
BR, Valeria.



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

hi,@terpilka

      After my research, you can do these follow my steps like below:

Step 1:

use this formula to add a new table and create the relationship with basic table

regions = VALUES('Project Tasks'[region])

18.PNG

Step 2:

create a measure by using formula like below:

Measure 4 = if(min('Project Tasks'[indicator]) = "old",CALCULATE( sum('Project Tasks'[TaskDuration]), all(regions[region])), if(min('Project Tasks'[indicator]) = "new", sum('Project Tasks'[TaskDuration]), 999))

Step3:

Darg field regions from table Regions into slicer visual

Result:

19.PNG

here is demo, please try it.

https://www.dropbox.com/s/awpgenjbhp5ewje/new%20exchange.pbix?dl=0

 

Best Regards,

Lin

 

 

Community Support Team _ Lin
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

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi,@terpilka

      After my research, you can do these follow my steps like below:

Step 1:

use this formula to add a new table and create the relationship with basic table

regions = VALUES('Project Tasks'[region])

18.PNG

Step 2:

create a measure by using formula like below:

Measure 4 = if(min('Project Tasks'[indicator]) = "old",CALCULATE( sum('Project Tasks'[TaskDuration]), all(regions[region])), if(min('Project Tasks'[indicator]) = "new", sum('Project Tasks'[TaskDuration]), 999))

Step3:

Darg field regions from table Regions into slicer visual

Result:

19.PNG

here is demo, please try it.

https://www.dropbox.com/s/awpgenjbhp5ewje/new%20exchange.pbix?dl=0

 

Best Regards,

Lin

 

 

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

Many thanks,

It works.

 

BR, 

Valeria!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.