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
MEverts
Frequent Visitor

DAX Measure for Active Subscribers not plotting in Excel

Dear, 

 

I'm looking to plot the number of Open and Answered data-entry queries in Excel using a dax patern for active subscribers/tickets.  

 

My Source data looks like this, together with a disconected Calendar-table:

IDSite #Subject IDTypeCurrent StatusStart_date_statusEnd_date_status
1171102102001System QueryOpen State11/23/2017 14:3511/23/2017 14:37
1172102102001System QueryOpen State11/23/2017 14:4011/27/2017 19:49
1173102102001Site Query from PMOpen State1/4/2018 22:351/10/2018 15:05
1173102102001Site Query from PMAnswered State1/10/2018 15:054/16/2018 20:39
1174102102001Site Query from PMOpen State1/4/2018 22:371/10/2018 15:02
1174102102001Site Query from PMAnswered State1/10/2018 15:024/16/2018 20:40
1175102102001Site Query from PMOpen State1/4/2018 22:3810/17/2018 16:30
1175102102001Site Query from PMAnswered State10/17/2018 16:3010/18/2018 15:16
1176102102001Site Query from PMOpen State1/4/2018 22:391/10/2018 16:17
1176102102001Site Query from PMAnswered State1/10/2018 16:177/20/2018 16:01

I have got it working in Power BI by amending the helpful patern at the Radacad website, which is great:

 

Active Subscribers =
VAR _CurrDate =
    SELECTEDVALUE( 'Calendar'[Date] )
VAR _FirstStartDate =
    MIN ( 'STATIC_Query Metrics_Final'[Start_date_status] )
VAR _Queries =
    FILTER (
        'STATIC_Query Metrics_Final',
        'STATIC_Query Metrics_Final'[End_date_status] >= _CurrDate
            && 'STATIC_Query Metrics_Final'[Start_date_status] < - _CurrDate
    )
VAR _countRows =
    COUNTROWS ( _Queries )
RETURN
    IF (
        _CurrDate <= TODAY ()
            && _CurrDate >= _FirstStartDate,
        IF ( ISBLANK ( _countRows ), 0, _countRows )
    )

 

Capture.JPG

However, I would like to have a similar plot in an Excell dashboard.

 

As the SELECTEDVALUES command is not available in Excel 365, I instead use IF(HASONEVALUE( 'Calendar'[Date]),VALUES( 'Calendar'[Date]), as seen below for the first Variable _CurrDate:

 

Active Subscribers :=
VAR _CurrDate =
    IF ( HASONEVALUE ( 'Calendar'[Date] ), VALUES ( 'Calendar'[Date] ) )
VAR _FirstStartDate =
    MIN ( 'STATIC_Query Metrics_Final'[Start_date_status] )
VAR _Queries =
    FILTER (
        'STATIC_Query Metrics_Final',
        'STATIC_Query Metrics_Final'[End_date_status] >= _CurrDate
            && 'STATIC_Query Metrics_Final'[Start_date_status] < - _CurrDate
    )
VAR _countRows =
    COUNTROWS ( _Queries )
RETURN
    IF (
        _CurrDate <= TODAY ()
            && _CurrDate >= _FirstStartDate,
        IF ( ISBLANK ( _countRows ), 0, _countRows )
    )

 

 

Perhaps my understanding of the Excel alternative for SELECTEDVALUE incorrect, but unfortunately when create a area plot in the exact same way as in Power BI, there is no reasonable output, just a blank graph with an y-axis from 0 to 1:

Capture1.JPG

I must be doing something wrong; any help or insight you could give me is much appreciated.

 

Best regards,

 

Martijn

 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @MEverts 

 

You can use 

VAR _CurrDate =
    MAX( 'Calendar'[Date] )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

View solution in original post

3 REPLIES 3
Mariusz
Community Champion
Community Champion

Hi @MEverts 

 

You can use 

VAR _CurrDate =
    MAX( 'Calendar'[Date] )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

Dear Mariusz,

Thank you so much!! It works:-)

Best regards,


Martijn

 

Mariusz
Community Champion
Community Champion

Hi @MEverts 

 

No problem, happy to help!

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

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