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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
joan-la
New Member

All Referencing a measure in another measure

joanla_0-1632777285662.png

 

Is there a way I can use ALL or other dax formula to apply a page filter only in the first 2 columns but exclude it from the last 2 columns which are measures (QTDs)? 

 

Thanks!

 

3 REPLIES 3
colacan
Resolver II
Resolver II

@joan-la Hi joan,

You might think CALCULATE(SUM(Query[Revenue]),Query[Fiscal Week]="2021-W14") as 
"if Query[Fiscal Week] ="2021-W14" then calculate..." expecting it will return 0 if [Fiscal Week] is not "2021-W14".

That is not ture. 

Actually, CALCULATE(SUM(Query[Revenue]),Query[Fiscal Week]="2021-W14" means whatever outter filter is(from your filter page), provide the value of SUM(Query[Revenue] when [Fiscal Week]="2021-W14" which is 3 in your example. that's why you always get the same answer regardless your filter.

If you want to get QTD based on your selected week you can simply use TOTALQTD with complate date table related to your Revenue table.

However if you need to keep current way, below code might give you the value you intended. 

VAR W14 = IF(SELECTEDVALUE(Query[Fiscal Week])="2021-W14", SUM(Query[Revenue]),0)

 

hope this helps you.

 

Plesae mark as solution if this resolved your issue.
 

Greg_Deckler
Super User
Super User

@joan-la Theoretically but would need more information. You could use something like CALCULATE([Measure],ALL('Table')) for example. Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

This is a sample of what I have

 

Q2 QTD =
VAR W14 = CALCULATE(SUM(Query[Revenue]),Query[Fiscal Week]="2021-W14")
VAR W15 = CALCULATE(SUM(Query[Revenue]),Query[Fiscal Week]="2021-W15")


Var Result = W14+W15
Return
IF(ISBLANK(Result),0,Result)

 

------------------------------------

Lets say that W14= 3  and W15 = 5. I would like to receive 8. 

But I have a page filter of "Fiscal Week" to show specifics one. If I filter by WK 15, WK 16, WK 17 for example. then I will only receive in Q2 QTD  the result of 5 instead of 8.

 

So I will like to apply the page filter "Fiscal Week" to the rest of the table but excluding it from the QTD one so I can receive in this case the 8 value no matter the filters being applied. 

 

Please let me know if this helps or additional information is required

 

Thank you!!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.