"dax query view"
11 TopicsDax Formula not working
CMLYNAACount = VAR SelectedMonth = MAX(Query1[CSMDate]) VAR LastYearSameMonthStart = EOMONTH(SelectedMonth, -12) + 1 VAR LastYearSameMonthEnd = EOMONTH(SelectedMonth, -12) RETURN CALCULATE( SUM(Query1[NACCount]), Query1[CSMDate] >= LastYearSameMonthStart && Query1[CSMDate] <= LastYearSameMonthEnd ) I am trying to get a count based on a filter however, i am not getting any results on this query. Can you advise whats wrong? I am trying to get NAC Count based off the date slicer for last year current month . e.g if slicer says november 2024 this field should show november 2023Solved845Views0likes3CommentsDynamic name
CurrentMonthLastYearCount = VAR SelectedMonth = MAX(Query1[SetupDate]) VAR LastYearSameMonthStart = EOMONTH(SelectedMonth, -13) + 1 VAR LastYearSameMonthEnd = EOMONTH(SelectedMonth, -12) VAR Result = CALCULATE( SUM(Query1[NewCount]), Query1[SetupDate] >= LastYearSameMonthStart && Query1[SetupDate] <= LastYearSameMonthEnd ) RETURN Result I am using this DAX however i want the name to be dynamic based on slicer selection. E.g. if i select feb 2025, it should show feb 2024.Solved1.4KViews0likes7Commentsadjust query to exclude holidays and weekends
i wrote this query that calulate work hours (8:30 to 16:30) and need it to exclude holidayes ( i have a seperate holiday table that has holiday start date and holiday end date) and i need it to exclude weekends (friday and saturday) here is the dax power query workhours without out of working hours = VAR WorkTimeStart = TIME ( 08, 30, 00 ) VAR WorkTimeEnd = TIME ( 16, 30, 10 ) VAR WorkingHours = ( WorkTimeEnd - WorkTimeStart ) -- Start and End date/time on current row VAR StartingDateTime = [Created - Copy] VAR EndingDateTime = [Completed - Copy] VAR StartingTime= StartingDateTime - TRUNC ( StartingDateTime ) VAR StartingDate = StartingDateTime - StartingTime VAR EndingTime = EndingDateTime - TRUNC ( EndingDateTime ) VAR EndingDate = EndingDateTime - EndingTime -- Adjust start/end times to fall within working hours. VAR StartingTimeEffective = MIN ( MAX ( StartingTime, WorkTimeStart ), WorkTimeEnd ) VAR EndingTimeEffective = MAX ( MIN ( EndingTime, WorkTimeEnd ), WorkTimeStart ) -- Adjust for hours not worked on StartingDate -- StartingTimeOffset will always be <= 0 VAR StartingTimeOffset = WorkTimeStart - StartingTimeEffective -- Adjust for hours not worked on EndingDate -- EndingTimeOffset will always be <= 0 VAR EndingTimeOffset = EndingTimeEffective - WorkTimeEnd VAR DayCount = EndingDate - StartingDate + 1 VAR TotalTimeInDays = DayCount * WorkingHours + StartingTimeOffset + EndingTimeOffset VAR TotalTimeInHours = TotalTimeInDays * 24 VAR TotalTimeInHoursRounded = ROUNDDOWN ( TotalTimeInHours, 0 ) RETURN TotalTimeInHoursRounded650Views0likes1Commentdax query to fetch filtered row
I have a power bi dashboard, the user can filter on account id, I need a dax query to return what the filtered account id is. The account id is in a table however the account id could be repeated mutliple times. I have tried evaluate row in dax however returns NULL. I need this dax query to work along side power automate.Solved877Views0likes3CommentsHow do I copy my query from Dax Query View to Power BI dash board?
I have written a Dax Query in Dax Query View. The final result of this query displays a table I would like to display this table on a dashboard. I am new to PowerBI and I am unable to use this. Copying this as a measure gave me syntax errors, though this works in Dax Query View. Can you please let me know how I can use this query and display the resulting table on the dashboard? (Just a note: This is a self-contained portion of a much larger query that could not be done other than through a Dax query, hence had to resort to writing a query) EVALUATE VAR TimeTable = NATURALINNERJOIN( NATURALINNERJOIN( SELECTCOLUMNS( TimeCharges, "id", CONVERT( TimeCharges[Timesheet Id], INTEGER ), "Rate", TimeCharges[Billing Rate], "Amount", TimeCharges[Amount] ), SELECTCOLUMNS( Timesheet, "id", CONVERT( Timesheet[Id], INTEGER ), "ProjectID", CONVERT( Timesheet[Project ID], STRING ), "Qty", Timesheet[Hours] ) ), SELECTCOLUMNS( Projects, "ProjectID", CONVERT( Projects[ID], STRING ), "Project Name", Projects[Name] ) ) Return TimeTable //(The result had 414 rows)1.5KViews0likes4CommentsHep with the formula
Anonymous Anonymous CarlossSainz Hi I have a formula below for calculating the sum of gross risk potential in the table. I want the sum calculation based on the risk name instead of summing up the entire column. I tried the below formula but it is not giving the correct value. I can give an example The total sum of gross risk potential is 100. But the gross risk potential for risk A is 20. I want to get this separate value for all the risks i have in a single column without creating multiple columns. TotalRiskPotentialPerRisk = SUMX( VALUES(Top_Risk_Controls[Riskname]), CALCULATE( SUM(Top_Risk_Controls[Gross_risk_potential]), Top_Risk_Controls[Riskname] = EARLIER(Top_Risk_Controls[Riskname]) ) ) In the above formula, im getting the same values as the gross risk potential column instead of the sum of them based on the risk name. How to get the sum of the values based on the risk name. Please note that the data source is the sharepoint list.3.5KViews0likes6CommentsUse a single value to return multiple metric in bar chart?
Hello all! I have a question, I have a dataste set which looks into sum of Savings Balance for Dec'23 and for Mar'24. I have it summed up and displayed like this in bar Now I need to add a Fixed Deposit metric also that again look into sum for Dec'23 and Mar'24. I figured that having a filter that I can use to switch between Saving Account and Fixed Deposit metric for two dates would be smart, but I cant seem to form a filter that works. I made a new table called Measure Table with the below column, with these options, then a new measure, but it doesnt work. I think im missing something but not sure if theres a way to create a filter that shows value for Savings & FD. SA = IF(CONTAINS('Measure Table', 'Measure Table'[Metrics], "CASA"), [DEC'23], [Mar'24]) If any help that would be great! Thank You!Solved1KViews0likes3CommentsURGENT!! Dax query giving blank
Hello, Power Bi community, I need help with this Dax query below: here is the sample pbix as well: https://drive.google.com/file/d/1AC0jrk_w7ik0mX34jKGTzE7cI49ySkNI/view?usp=sharing I'm getting blank when I run this code, can you help me I can get the correct data: The expected output for this is 0.3%. Latest 4 Weeks %Contribution (Red) = CALCULATE( [Latest 4 Weeks %Contribution], FILTER( 'Data by Channels', 'Data by Channels'[L4W PP %Cont Color] = "Red" && 'Data by Channels'[State] <> "Total US" && 'Data by Channels'[State] <> "Core 7 States" ) ) the dependent queries are below: Latest 4 Weeks %Contribution: Latest 4 Weeks %Contribution = DIVIDE( SUM('Data by Channels'[Latest 4 Weeks Ending]), CALCULATE(SUM('Data by Channels'[Latest 4 Weeks Ending]), 'Data by Channels'[State] = "Total US") ) L4W PP %Cont Color: L4W PP %Cont Color = SWITCH ( TRUE(), Max('Data by Channels'[Measures]) = "Value Share" || Max('Data by Channels'[Measures]) = "Volume Share (UC)" || Max('Data by Channels'[Measures]) = "Trial (% HH Buying, 1x)" || Max('Data by Channels'[Measures]) = "Average Weekly ACV Distribution" || Max('Data by Channels'[Measures]) = "Volume Segment" || Max('Data by Channels'[Measures]) = "Dollar Segment" || Max('Data by Channels'[Measures]) = "Repeaters (% HH Buying, 2x)" || Max('Data by Channels'[Measures]) = "Household Penetration" || CONTAINSSTRING(Max('Data by Channels'[Measures]), "Average Weekly CWD Distribution") || CONTAINSSTRING(Max('Data by Channels'[Measures]), "Volume Sales (UC) by Merch"), IF( SUM('Data by Channels'[Latest 4 Weeks Ending]) - SUM('Data by Channels'[Previous Period 4 weeks]) < 0, "Red", IF( SUM('Data by Channels'[Previous Period 4 weeks]) = 0, "Grey", "Green" ) ), TRUE(), IF( (SUM('Data by Channels'[Latest 4 Weeks Ending])/SUM('Data by Channels'[Previous Period 4 weeks])-1) < 0, "Red", IF( SUM('Data by Channels'[Previous Period 4 weeks]) = 0, "Grey", "Green" ) ) ) Please take a look and let me know if you need anything else. Look forward to your replies. @MFelix , @amitchandak , @Ashish_MathurSolved876Views0likes4CommentsAllocate fee in same period
I have two tables like this Table A Enno Period Fee 1 Jan 2023 100 2 Jan 2023 400 1 Jan 2023 200 3 Mar 2023 400 1 Mar 2023 100 3 Mar 2023 200 Table B AlocateNo Alocateto Aloperiod AMOUNT 1 2 Jan 2023 100 1 3 Jan 2023 100 Table A - contained Engagement, period and Fee Table B - contained allocated engagementNo, EngagementNo (that want to alocate to desired engagement ), Alocation period and amounts For example, If I want to alocate fee from engagementNo 1 to engagementNo 2and 3,which same period as conditions in table B. How can I alocate correctly. I try many way but my data still duplicate in table A.Solved670Views0likes2Comments