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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

dax query for month

hiii

i am looking for dax to display past 2 months and current month raw sla%, mitsla%,count of call closed based on my month slicer i have.

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

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

hi paul

i have tried ur query but couldnt achieve the expected output

can you check the expected output nd help me

 

present outputpresent outputexpected outputexpected output

View solution in original post

3 REPLIES 3
V-pazhen-msft
Community Support
Community Support

@Anonymous 

With your current measure, the month name is the a text type column, you cannot use it to company with [month.no] that is a number. In fact you do not need a month name or month column, try just change it to company with today's month no, and use allselected() as the context. 

 

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

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

hi paul

i have tried ur query but couldnt achieve the expected output

can you check the expected output nd help me

 

present outputpresent outputexpected outputexpected output

@Anonymous 
Sorry, I was misunderstood. I have looked into the pbix, I guess it is not possible to achieve your expect output.

 

The problem you want to show 3 months data but only selected 1 month, you can use  dax measure filters the month range but only aggregates the 3 months data and displays the  result on the selected month. My suggestion is change the slicer to multi-selection, and hold on ctrl to select needed month name.

monthname.JPG

 

However, I suggest you to create a month number column, and used the month number instead of month name in the report. 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors