filters
58 Topicscreate measures with filters
Hello, I need to create measures using some filter to be able to make some card visuals. here is what I did: I have my date base with all years information, so for making the "sales per year" i made to measures: 2025 = SUM(...) and filtered in 2025 poryjected sales. 2024 = CALCULATE([Facturación],SAMEPERIODLASTYEAR('Calendar'[Date])) - I created a measure of get the sales of previous year. than I made a measure to get the difference between both 2024 adn 2025 sales. WHAT I SHOULD DO: I made to charts one "increasing of sales" detailed all the "clientes" that has a positive result and I was using the filter panel. and another of "lost sales" with all the negative results. I need to add some cards to summarize the totals. I have one showing the total of sales in 2025 I need a card showing the total of increaisng sales that is "2,066,314" and a card showing the total of lost sales that is "-919,865" thank you!Solved774Views0likes2CommentsMeasures using filters of negative and positive results
Hello, would like to know how can I make measures with calculations but using filters. here is an example of what I pretend to do I have the sales per country on 2023 and 2024. I am comparing them. so I was thinking to make a measure to show only the countrys that has losing of sales . and another measure that let me show only the countries having an increase of sale with no return of the negative numbers. I think I need to make measures because at the end I need to make a comparative chart showing the losing sales and the increase of sales with the sales of previous year. COUNTRY 2023 2024 Difference USA $5,000 $4,300 -$700 FRANCE $5,000 $5,000 $0 GERMANY $3,500 $2,000 -$1,500 MEXICO $600 $1,200 $600 ITALY $5,500 $5,300 -$200 CHINA $5,000 $3,000 -$2,000 JAPAN $5,000 $4,580 -$420 AUSTRALIA $6,000 $6,100 $100 TOTAL $35,600 $31,480 -$4,120 NEW MEASURES Lost Sales Increase of sales: USA -$700 MEXICO $600 GERMANY -$1,500 AUSTRALIA $100 CHINA -$2,000 $700 JAPAN -$420 -$4,620 FINAL CHART I NEED TO ACHIEVE 2023 LOST SALE INCREASE OF SALES $35,600 -$4,620 $700 thank you!Solved679Views0likes2CommentsDAX Getting Same Grand Total Amount in Each Row
If I select 'Current Hierarchy'[Sales Code] and 'Quota Results'[Location Quota], it displays the correct results row by row. But I have onother table called 'BCP' which has a [Sales Code]. When I select it with Location Quota it gives me the same grand total in each row. So I created a relationship between 'Current Hierarchy'[Sales Code] and 'BCP'[Sales Code]. But the results are still the same. Any idea how to fix?Solved1.1KViews0likes4CommentsI’m trying to calculate a specific type of what-if scenario
What is the project? I’m developing a solution to show management our overall risk posture based on data coming in from audits. Each finding has a score associated with it (1=Low 2=Medium, 3=High, 4=Critical, but the score number can be decimal values in between these). Also, these findings have a status, so once they are actually remediated in the wild, they don’t show up on a report. I’ve created reports that visually show our average risk score categorized out in several different ways (what type of asset, which overall risk category, etc.). One of the other tables has projects, with a one-to-many relationship to the findings (so we can associate multiple findings to a project, which would identify what findings would be remediated if we ran with a proposed project). This is related through an intermediary table FindingsToProjects. We want to show what happens to our overall risk scores when a particular project is run. So for example, if we run project XYZ (which would remediate finding B and finding C), how would our risk score look then? So in the FindingsToProjects table we basically have this: ProjectName FindingName Project XYZ Finding B Project XYZ Finding C Project LMN Finding A What is the problem I’m having? I thought I had this all figured out, because when I deselect a project in the slicer on the report, the score changes, etc. But what I realized is that it’s now just showing the average risk score of a filtered down set of risks. So for example, if this is my data (fictitious, but showing what I’m trying to do): FindingName RiskScore FindingStatus FindingClosedDate Finding A 2.67 Closed 5/6/2024 Finding B 2.33 Open Finding C 4.00 Open Finding D 1.33 Open Finding E 3.33 Open In this case, the measure I created named AveRisk: AveRisk = AVERAGE([RiskScore]) Would have an overall value of 2.73 (for example, in a Card visual, have this meause displaying Average). Once I filter out the “Closed” in a visual, then the average would be 2.75. That works fine. It’s when I use the slicer to deselect a project that the problem comes up. If finding B and C are associated to the project “Project XYZ”, right now when I deselect that project in the slider it shows a new risk score of 2.33 (which is show the average of finding D and E, since B and C are filtered out and finding A is closed). What I *WANT* it to display is a score of 1.17 (in other words, Average of: Finding B (with a score of 0 since it would be remediated with that project XYZ), finding C (with a score of 0), finding C (1.33), and finding D (3.33)). I think I need to do this using some DAX / meaasures I'm just not thinking of yet, but not sure the best way to do it. (Also, I have full ability to modify the source tables if needed, like adding new columns or whatever). Please help!! And thanks in advance!Solved524Views0likes1CommentBlank Values when multiple filters are applied
Hello - I have a simple dataset that looks like this: Category Sub-Category Class Value XX Value YY AAA X1 A 1000 2000 AAA X2 A 400 2500 AAA X3 B 2000 300 BBB X2 A 5000 1000 CCC X1 B 150 1200 CCC X2 B 350 10000 CCC X3 A 300 800 Then I have a summary table that looks like this: Category Value A (=Value XX/2) Value B(=Value YY/2) AAA 1700 2400 BBB 2500 500 CCC 400 6000 Then I have two filters, one for Value A (Filter A) and one for Value B (Filter B), that are the result of the concatenation of: Filter A = "Class" + "Sub-Category" (ie. A-X1, A-X2, B-X3,...) Filter B = "Class_duplicate" + "Sub-Category_duplicate" (ie. A-X1, A-X2, B-X3,...) --> I created a duplicate field for both "Class" and "Sub-Category" to avoid interference between the two filters One of my goals was to apply Filter A only to Value A (with Value B not impacted by any selection) and Filter B to apply only to Value B (with Value A not impacted by any selection). I was able to accomplish this with the following measures: Value A = CALCULATE( DIVIDE(Value XX,2), ALL(Table_name, Class, Sub-Category) ) Value B = CALCULATE( DIVIDE(Value YY,2), ALL(Table_name, Class_duplicate, Sub-Category_duplicate) ) This works only if: I apply one Filter at a time OR if the selected combination of "Class"+"Sub-Category" from both filters is the same But considering that my summary table is at the "Category" level, while my filters are at the "Class"+"Sub-Category" level, the PROBLEM is if: I make a selection from both filters AND the combination of "Class"+"Sub-Category" is different between the two filters, which will return blank values in my summary table for both Value A and Value B. I tried combining different functions inside the measures Value A and Value B, but with no success. I hope I made it clear to understand, any recommendation/hint will be greatly appreciated. Thanks! Davide1.2KViews0likes2CommentsIgnoring a field filter but still wanting to sort on that field...
Hi all, I've been struggling with this and my knowledge of DAX obviously isn't up to task, so I'm hoping someone here can point me in the right direction.... DESIRED OUTCOME I want to create a tooltip that shows a graph of time booked (man hours from timelogging data) across months. Here's an example of the tooltip I'd like to see... CHALLENGE The challenge I'm having is that on the page that the tooltip should be linked from, has a filter on a specific [Month]. I don't want the month filter to persist through to the tooltip as I want to see all months, but other filters should persist. DATA STRUCTURE Here is an indication of the data structure I have (table and field names are correct)... I've tried various DAX CALCULATE syntax but no luck so far. Thanks in advance....Solved952Views0likes5CommentsHave calculations only work in the filtered context
I hope this is a simple question and I don't know what to actually google. This is just a sample of what I actually want to do but this functionality applies to so many things i want to do. I have a table that has 2 columns. [TestName, Log Time] Every test ran for a different period of time and my goal is to calculate how much time is left in the test at any specific log time. I'm making a line graph over time. TimeRemaining vs LogTime. The formula for this is simple TimeRemaining = Max(LogTime) - LogTime. The issue that Max(LogTime) for the data set is larger than Max(LogTime) for any particularly TestName that i'm filtering to. When i filter my line graph to an individual test name how do I ensure that the filter applies to the TimeRemaining calculation? As you can see in the picture below the TimeRemaining is not 0 at the end of this test since the context of my filter is not correctly applied to the calculation.Solved772Views1like2CommentsMeasure to Filter out Values Based on Current Time
I'm working on an operational dashboard to show production by location. When the executive looks at the dashboard in the early morning before store hours, I want them to see yesterday's production numbers. After 9 am, I want them to start seeing today's production. How do I filter based on the current time? Here's the if statement I'm testing: // IF the current hour is before 9 am IF(TIME(HOUR(UTCNOW()), MINUTE(UTCNOW()), SECOND(UTCNOW())) < TIME(9,00,00), // THEN show yesterday's numbers CALCULATE(SUMX(FactTagProduction, [ValueStocked]), DATEADD(FactTagProduction[DateID], -1, Day) ), // ELSE show today's numbers CALCULATE(SUMX(FactTagProduction, [ValueStocked]), FactTagProduction[DateID] = TODAY() ) )Solved1.4KViews0likes4CommentsNeed Help with DAX for Multiple Columns with Multiple Equations
I am trying to calculate a number using a formula. Depending on what value is in the Description column, I want to multiple it by a different number. I can get one statement to work but it does not like that I have filters on the different equations. I searched and I do not see anything as complicated as I am trying to accomplish. The table looks like: Description Apr 24 May 24 Jun 24 Jul 24 Aug 24 High Use Lawn Soil 0 0 0 0 0 Plant Bed Soil 0 0 0 0 0 Horticultural Subsoil 0 0 0 0 0 Sand Based Structural Planting Soil 0 0 0 0 0 Lightweight Plant Bed Soil 0 0 0 0 0 Bioretention Planting Soil 0 0 0 0 0 Meadow Soil 0 0 0 0 0 Crushed Stone for Bioretention Basin 0 0 0 0 0 Sand and Gravel for Reinforced Turf 0 0 0 0 0 Sand and Gravel for Bioretention Basin 0 0 0 0 0 Sand for Bioretention Basin 0 0 0 0 0 Sand over Structure 0 0 0 0 0 Sand for Subsurface Drainage 0 0 0 0 0 Sand-Compost Blend 0 0 0 0 0 This is easily written in Excel where the "Description" field is column A. This Excel formula would be copied into each column. =B2*0.4+B3*0.5+B4*0.67+B5*0.13+B6*0.75+B7*0.2 =C2*0.4+C3*0.5+C4*0.67+C5*0.13+C6*0.75+C7*0.2 ETC I want the DAX formula to calcuate this expression for all columns. The statement below is only using the April 2024 column. I figured if I could get the statement to work, I could work on getting it to calculate the formula for all columns after that. I tried a few things but I am so confused with the DAX syntax. Base Wood = CALCULATE (PRODUCTX('All_Projects', 'All_Projects'[Apr 24] * 0.4 ), FILTER ('All_Projects', 'All_Projects'[Description] = "High Use Lawn Soil") + ('All_Projects', 'All_Projects'[Apr 24] * 0.5 ), FILTER ('All_Projects', 'All_Projects'[Description] = "Plant Bed Soil") + ('All_Projects', 'All_Projects'[Apr 24] * 0.67 ), FILTER ('All_Projects', 'All_Projects'[Description] = "Horticultural Subsoil") + ('All_Projects', 'All_Projects'[Apr 24] * 0.13 ), FILTER ('All_Projects', 'All_Projects'[Description] = "Sand Based Structural Planting Soil")+ ('All_Projects', 'All_Projects'[Apr 24] * 0.75 ), FILTER ('All_Projects', 'All_Projects'[Description] = "Lightweight Plant Bed Soil") + ('All_Projects', 'All_Projects'[Apr 24] * 0.2 ), FILTER ('All_Projects', 'All_Projects'[Description] = "Bioretention Planting Soil") ) +0 An error message is being displayed - A function 'Filter' has been used in a TRUE/FALSE... I wish I could get DAX Studio. Any help would be appreciated.Solved829Views0likes1CommentMultiple Filters from multiple tables with a VAR
Hello Community, I have a tricky problem that I am trying to solve related to a DAX. I have daxed the below to calculate the distinct count of claims based on 3 conditions and summing them at the end for whatever applies. However, It is giving me me that it is incorrect. Any idea on what I am missing or perhaps is there a better way to dax it. #Claims - <100$ = VAR Condition1= CALCULATE(DISTINCTCOUNT(claim[Claim]), FILTER(claim, claim[Total Employee payment Value])<100, FILTER(paymentbatchtable, paymentbatchtable[Payment file generated] = "Yes" && paymentbatchtable[Payment Batch] = SELECTEDVALUE(paymentbatchtable[Payment Batch])) VAR Condition2= CALCULATE(DISTINCTCOUNT(claim[Claim ID]), FILTER(claim, claim[Total Employee Payment Value])<100, FILTER(paymentbatchtable, paymentbatchtable[Payment File Cheque Generated]= "Yes" && paymentbatchtable[Payment Batch] = SELECTEDVALUE(paymentbatchtable[Payment Batch])) FILTER(claim, claim[Total Employee Money Value(Base)])<100, FILTER(chequerecord, CONTAINSSTRING(chequerecord[Payment Batch],"EFT")), FILTER(paymentbatchtable, paymentbatchtable[Payment File Cheque Generated]="Yes" && paymentbatchtable[Payment Batch] = SELECTEDVALUE(paymentbatchtable[Payment Batch])) VAR RESULT = Condition1 + Condition2 +Condition3 RETURN RESULT SUM986Views0likes4Comments