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

Need help on Matrix visual DAX logic

Hello Experts,

 

I'm trying one output in Matrix visual that expecting the monthly wise count  and when its come to Total in Matrix i need the average count over no. of months (non-blank) in the total. 

Please assist,

 

somthing like, instead of 28/12  need 28/6 (non-blank) in the Total area....

 

 Jan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Total
Average(Count) 4 64 8 24  Average(28/6)

 

In same scenorio, can we show like this?

 

 Jan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Total
Average Count 4 64 8 24     Total Count ,Instead of average here

 

 

Thanks in advance.

 

 

 

Regards,

Sarath.

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @SarathB2 

You can try  'HASONEVALUE' to change the matrix row total.

 

Count_month non_blank = 
IF(
    NOT(HASONEVALUE('Calendar'[Date].[Month])),
    CALCULATE(
        DISTINCTCOUNT('Calendar'[Date].[Month]),
        FILTER(
            'Calendar',
            'Calendar'[Date] in DISTINCT('Table'[Date])
        )
    )
)

 

 

Average(Count) = 
IF (
    HASONEVALUE ( 'Calendar'[Date].[Month] ),
    COUNTROWS ( 'Table' ),
    COUNTROWS ( 'Table' ) / [Count_month non_blank]
)

 

106.png

If it doen't meet your requirement ,please share your sample file or relevant screenshots(formulas,tables) 

 

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

 

 

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi, @SarathB2 

You can try  'HASONEVALUE' to change the matrix row total.

 

Count_month non_blank = 
IF(
    NOT(HASONEVALUE('Calendar'[Date].[Month])),
    CALCULATE(
        DISTINCTCOUNT('Calendar'[Date].[Month]),
        FILTER(
            'Calendar',
            'Calendar'[Date] in DISTINCT('Table'[Date])
        )
    )
)

 

 

Average(Count) = 
IF (
    HASONEVALUE ( 'Calendar'[Date].[Month] ),
    COUNTROWS ( 'Table' ),
    COUNTROWS ( 'Table' ) / [Count_month non_blank]
)

 

106.png

If it doen't meet your requirement ,please share your sample file or relevant screenshots(formulas,tables) 

 

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

 

 

Hey @v-easonf-msft ,
Thanks for your efforts for the solutions .
Great solution

..

amitchandak
Super User
Super User

@SarathB2 , if you Sum measure and you want Avg above month year

 

AverageX(Values('Date'[Month Year]), [Sum])

 

 

If you have Avg measure and you need sum above month level
Sumx(Values('Date'[Month Year]), [Avg])

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.