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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

dax

hi can some one help me with this it is really very imp for me

 https://drive.google.com/file/d/1BmG-flA6TE0v_sbka6rRtY0Aa2h8EsVT/view?usp=sharing 

i am using the below formulas to display my data for past 2 months nd current month based on month slicer selection

but i am unable to view my data.

can someone help me with dax query or a offset may also work to display my data.

R.SLA% 1 =
CALCULATE (
[M.SLA%],
FILTER (
'Query1',
'Query1'[Call Closed].[MonthNo] <= [month name]
&& 'Query1'[Call Closed].[MonthNo] >= [month name] - 2
&& 'Query1'[Call Closed].[Year] = YEAR ( TODAY () )
)
)
M.SLA% 1 =
CALCULATE (
[M.SLA%],
FILTER (
'Query1',
'Query1'[Call Closed].[MonthNo] <= [month name]
&& 'Query1'[Call Closed].[MonthNo] >= [month name] - 2
&& 'Query1'[Call Closed].[Year] = YEAR ( TODAY () )
)
)

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check:

 

1. Create another Dates table.

 

 

 

 

Dates =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2020, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Month", MONTH ( [Date] ),
    "MonthName", FORMAT ( [Date], "mmmm" )
)

 

 

 

 

 

2. Create columns in your Query table.

 

 

 

 

Call Closed Date = [Call Closed].[Date]

 

 

 

 

date.JPG

 

 

 

 

 

YearMonth = FORMAT([Call Closed Date],"YYYY MMMM")

 

 

 

 

 

 

3. Create relationship between the two tables.

relationship.jpg

 

4. Create measures.

 

 

 

 

M.SLA% 2 = CALCULATE([M.SLA%],DATESINPERIOD ( Dates[Date], MAX ( Dates[Date]), -3 , MONTH ))
RAW SLA% 2 = CALCULATE([RAW SLA%],DATESINPERIOD ( Dates[Date], MAX ( Dates[Date]), -3 , MONTH ))
Count of Call Closed = CALCULATE(COUNT(Query1[Call Closed]),DATESINPERIOD ( Dates[Date], MAX ( Dates[Date]), -3 , MONTH ))

 

 

 

 

 

5. Create visuals.

visuals2.JPGvisuals1.JPG

 

In addition, please change the slicer field to "MonthName" of "Dates" table.

slicer.JPG

 

 

 

 

 

Best regards

Icey

 

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

2 REPLIES 2
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check:

 

1. Create another Dates table.

 

 

 

 

Dates =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2020, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Month", MONTH ( [Date] ),
    "MonthName", FORMAT ( [Date], "mmmm" )
)

 

 

 

 

 

2. Create columns in your Query table.

 

 

 

 

Call Closed Date = [Call Closed].[Date]

 

 

 

 

date.JPG

 

 

 

 

 

YearMonth = FORMAT([Call Closed Date],"YYYY MMMM")

 

 

 

 

 

 

3. Create relationship between the two tables.

relationship.jpg

 

4. Create measures.

 

 

 

 

M.SLA% 2 = CALCULATE([M.SLA%],DATESINPERIOD ( Dates[Date], MAX ( Dates[Date]), -3 , MONTH ))
RAW SLA% 2 = CALCULATE([RAW SLA%],DATESINPERIOD ( Dates[Date], MAX ( Dates[Date]), -3 , MONTH ))
Count of Call Closed = CALCULATE(COUNT(Query1[Call Closed]),DATESINPERIOD ( Dates[Date], MAX ( Dates[Date]), -3 , MONTH ))

 

 

 

 

 

5. Create visuals.

visuals2.JPGvisuals1.JPG

 

In addition, please change the slicer field to "MonthName" of "Dates" table.

slicer.JPG

 

 

 

 

 

Best regards

Icey

 

If this post helps,then consider Accepting it as the solution to help other members find it faster.

BA_Pete
Super User
Super User

Hi @Anonymous ,

 

The immediate issue that appears in your calculation is that you are trying to compare [Call Closed].[MonthNo] with [month name] i.e. it appears as though you are trying to compare a number to a text value, akin to 'Is 5 >= Apple?'.

 

You need to ensure you are comparing similar data types then, if your output isn't what you need, add some further information in this thread around exactly what you are trying to achieve and expected output value(s).

 

Pete

 

 



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.