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
IMORTC
Regular Visitor

Fixed value for % ratios

How do I calculate a fixed measure based on a fixed filter like for example below. I need the base turnover calculation to be able to calculate % ratios.

 

Basically what I need is the field "2_test" to be populated with the turnover yet while the slicer filters still applies, in this case Month and Country?

 

 2018-02-14 14_11_58-New Openings - Power BI Desktop.png

 The current string I'm using is looking like this:

 

2_test = CALCULATE(SUM('FCC Data'[Actuals - Period]);'FCC Data'[AccountRetail]="Turnover")

2 ACCEPTED SOLUTIONS
ricardocamargos
Continued Contributor
Continued Contributor

Hi @IMORTC.

 

You can use:

CALCULATE(SUM(Table1[Actuals - Period]); FILTER(ALL(Table1); Table1[AccountRetail] = "Turnover"))

 

Be aware you should change this expression if you wanna sum the 2_test based on date/country:

 

CALCULATE(SUM(Table1[Actuals - Period]); FILTER(ALLEXCEPT(Table1; Table1[Date]; Table1[Country]); Table1[AccountRetail] = "Turnover"))

 

Ricardo

 

 

View solution in original post

Hi @IMORTC,

 

I could get your file now.

 

You should use measures instead of calculated columns to achieve this result. Also you just have "Turnover" values for 2 months, do you wanna compare the sum of those 2 months with any filter or just compare the sum of "Turnover" value inside the same month ?

 

If inside the same month you should have this:

 

_ACT % = SUM([Actuals - Period]) / CALCULATE(SUM('FCC Data'[Actuals - Period]);FILTER(ALLSELECTED('FCC Data');'FCC Data'[AccountRetail]="Turnover"))

 

I hope it helps you.

 

Let me know if u need some help.

 

Ricardo

 

 

View solution in original post

10 REPLIES 10
ricardocamargos
Continued Contributor
Continued Contributor

Hi @IMORTC.

 

You can use:

CALCULATE(SUM(Table1[Actuals - Period]); FILTER(ALL(Table1); Table1[AccountRetail] = "Turnover"))

 

Be aware you should change this expression if you wanna sum the 2_test based on date/country:

 

CALCULATE(SUM(Table1[Actuals - Period]); FILTER(ALLEXCEPT(Table1; Table1[Date]; Table1[Country]); Table1[AccountRetail] = "Turnover"))

 

Ricardo

 

 

Thank you for prompt help 🙂 That did the trick!

 

 

Another issue has come up... and I am pretty stuck here....

 

The previous offered solution works like a charm, when you apply the slicers individually. However if I pick two members in the slicer, see below, then it seem to double my ACT figures whereas only calcing the % ratio on one member... pls see below:

 

Correct view with one member selected in slicer:

 

2018-02-16 09_28_57-New Openings - Power BI Desktop.png

 

When picking multiple members in the slicer it shows eg 200% in the % column:

 

2018-02-16 09_29_45-New Openings - Power BI Desktop.png

 

My DAX code for the PCT columns look like this:

 

% = [Actuals - Period]/CALCULATE(SUM('FCC Data'[Actuals - Period]);FILTER(ALLEXCEPT('FCC Data';'FCC Data'[Calendar];'FCC Data'[AM];'FCC Data'[Country]);'FCC Data'[AccountRetail]="Turnover"))

Hi @IMORTC,

 

How do you relate the members with the data ?

 

Thanks,

 

Ricardo

Hi Ricardo,

 

Thx for your help! They are related in the same table... see below:

 

2018_02_16_11_49_21_Microsoft_Edge.png

 

 

@IMORTC,

 

Can you provide a sample dataset ?

 

Thanks,

 

Ricardo

here is the pbix file with test data:

 

PBIX file

Hi @IMORTC,

 

I could get your file now.

 

You should use measures instead of calculated columns to achieve this result. Also you just have "Turnover" values for 2 months, do you wanna compare the sum of those 2 months with any filter or just compare the sum of "Turnover" value inside the same month ?

 

If inside the same month you should have this:

 

_ACT % = SUM([Actuals - Period]) / CALCULATE(SUM('FCC Data'[Actuals - Period]);FILTER(ALLSELECTED('FCC Data');'FCC Data'[AccountRetail]="Turnover"))

 

I hope it helps you.

 

Let me know if u need some help.

 

Ricardo

 

 

Thx so much! @ricardocamargos,

 

I've been trying to get this to work from so many different angles and formulas, but your solution did the trick!!

 

Many many thanks for the help Smiley Happy

Hi @IMORTC,

 

I couldn't get you PBIX file, it just gave me an error.

 

Can you just give me a sample dataset ?

 

Thank u,

 

Ricardo

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.