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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
TM_Visual
Advocate III
Advocate III

Using DAX for test of statistical significance of differences between two groups in a time series

Summary: Using DAX for significance testing 

Data format:

 

GroupPopulation sizeYearScore
Male164201930
Female300201959
Male150201824
Female321201856
Male180201723
Female318201768
Male167201621
Female317201667
Male200201530
Female345201564
Male198201434
Female331201463

 

A sample of males and females took a test and scored between 1 and 100. I have data on an average score for each for years 2014 - 2019.

 

I would like to establish the significance of the difference between A and B.

Can Power BI run the statistical test required in DAX (or DAX plus Power Query), or would it have to be prepared in r or otherwise? Ideally I'd use Power BI without a plugin so that the file and technique can be used without additional downloads and adapted in the future.

 

While I'm trying to read guides to introductory statistics, if someone could also advise on the appropriate test I would be very grateful.

1 ACCEPTED SOLUTION
TeigeGao
Solution Sage
Solution Sage

Hi @TM_Visual ,

According to your description, my understanding is that you are going to calculate the difference between the Male group and Female group in the same year, in this scenario, we can use the following DAX query: 

Difference =
CALCULATE (
    MIN ( 'Table'[Score] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Year] = MIN ( 'Table'[Year] )
            && 'Table'[Group] = "Male"
    )
)
    - CALCULATE (
        MIN ( 'Table'[Score] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Year] = MIN ( 'Table'[Year] )
                && 'Table'[Group] = "Female"
        )
    )

The result will like below:

PBIDesktop_0h870k32Kt.png

Best Regards,

Teige

View solution in original post

1 REPLY 1
TeigeGao
Solution Sage
Solution Sage

Hi @TM_Visual ,

According to your description, my understanding is that you are going to calculate the difference between the Male group and Female group in the same year, in this scenario, we can use the following DAX query: 

Difference =
CALCULATE (
    MIN ( 'Table'[Score] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Year] = MIN ( 'Table'[Year] )
            && 'Table'[Group] = "Male"
    )
)
    - CALCULATE (
        MIN ( 'Table'[Score] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Year] = MIN ( 'Table'[Year] )
                && 'Table'[Group] = "Female"
        )
    )

The result will like below:

PBIDesktop_0h870k32Kt.png

Best Regards,

Teige

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors
Top Kudoed Authors