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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Poojara_D12
Super User
Super User

DAX KPI Issue

Hi,

I'm creating a measure in which I want to count monthly average of sales (With and without tax), as per Financial year. If the user select previous FY it should divide the amount by 12 if current than amount divide by (current month -1).

I have written a dax for the same in DAX query window, where it is showing me the expected output for current and previous year.

Poojara_D12_0-1731932528334.png

 

I use the same code and create a new measure and it's not showing the correct output as shown in DAX query window.

There's no page or report level filters in the dashboard. Don't know why it's not showing the correct result.

Poojara_D12_1-1731932660578.png

The correct result is the 1st image in DAX query view.

 

Can anyone please help??

 

@FreemanZ , @SamWiseOwl , @Dangar332 , @DataNinja777 , @Ritaf1983 , @Kedar_Pande 

 

Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
YouTube: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
3 REPLIES 3
Dangar332
Super User
Super User

Hi, @Poojara_D12 

Can you furthur clarify your requirment ?, it's hard to predict what you looking for from above description.

 

rohit1991
Super User
Super User

Hi, Wrap your existing DAX logic in a calculate  function within the measure to explicitly control the context:

Monthly Average Without Tax =
VAR StartDate =
CALCULATE(
MIN('Calendar'[Date]),
'Calendar'[FiscalYear] = SelectedFiscalYear
)
VAR EndDate =
CALCULATE(
MAX('Calendar'[Date]),
'Calendar'[FiscalYear] = SelectedFiscalYear
)
VAR IsFiscalYearComplete =
MAX('Purchase Analysis'[Posting_Date]) <= EndDate
VAR SalesInFiscalYear =
CALCULATE(
SUM('Purchase Analysis'[Purchase Amount]),
'Calendar'[FiscalYear] = SelectedFiscalYear,
'Purchase Analysis'[Type] = "Item"
)
VAR MonthsInPeriod =
IF(
IsFiscalYearComplete,
12,
DATEDIFF(StartDate, TODAY(), MONTH) - 1
)
RETURN
DIVIDE(SalesInFiscalYear, MonthsInPeriod, 0)



  1. Explicit Filter Context: The calculate function ensures the measure operates in the same evaluation context as in the DAX query window.

  2. Dynamic Context Management: It avoids unexpected filter overrides by visuals or the model relationships.

Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
Kedar_Pande
Super User
Super User

@Poojara_D12 

Please share a simplified version of your PBIX file (in English) without sensitive data. You can upload it to a public cloud service like OneDrive, Google Drive, or Dropbox and share the link. This will help in understanding your data structure and the issue, allowing for more precise guidance.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.