cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Helper II

## Matrix total

Greetings supporter,

I have two values when i put on the total first value calculated by column that is right, and Second value by Row that is wrong as the below total. how to make both value calculate by columns

1 ACCEPTED SOLUTION
Community Champion

@TarifAlanazi
Create a date dimension table and use the columns from that table in your visual instead of the date columns from the fact table.
You can use this code for the calculated table:

``````Date =
GENERATE (
CALENDARAUTO (),
VAR Yr = YEAR ( [Date] )
VAR Mn = MONTH ( [Date] )
VAR Qr = QUARTER ( [Date] )
VAR MnQ = Mn - 3 * (Qr - 1)
VAR Wd = WEEKDAY ( [Date], 2 )
RETURN ROW (
"Year", Yr,
"Year Quarter", FORMAT ( [Date], "\QQ-YYYY" ),
"Year Quarter Sorting", Yr * 100 + Qr,
"Quarter", FORMAT ( [Date], "\QQ" ),
"Year Month", FORMAT ( [Date], "MMM-YYYY" ),
"Year Month Sorting", Yr * 100 + Mn,
"Month", Mn,
"Day of Week", Wd,
"Week Day", FORMAT ( [Date], "dddd" )
)
)``````

5 REPLIES 5
Community Champion

@TarifAlanazi
Create a date dimension table and use the columns from that table in your visual instead of the date columns from the fact table.
You can use this code for the calculated table:

``````Date =
GENERATE (
CALENDARAUTO (),
VAR Yr = YEAR ( [Date] )
VAR Mn = MONTH ( [Date] )
VAR Qr = QUARTER ( [Date] )
VAR MnQ = Mn - 3 * (Qr - 1)
VAR Wd = WEEKDAY ( [Date], 2 )
RETURN ROW (
"Year", Yr,
"Year Quarter", FORMAT ( [Date], "\QQ-YYYY" ),
"Year Quarter Sorting", Yr * 100 + Qr,
"Quarter", FORMAT ( [Date], "\QQ" ),
"Year Month", FORMAT ( [Date], "MMM-YYYY" ),
"Year Month Sorting", Yr * 100 + Mn,
"Month", Mn,
"Day of Week", Wd,
"Week Day", FORMAT ( [Date], "dddd" )
)
)``````

Community Support

Hi @TarifAlanazi,

You can take a look at the following link about Dax measure total calculation issue if helps:

Measure Totals, The Final Word

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Community Champion

@TarifAlanazi you can PM me and we could do a zoom to look together.

Helper II

what do you meane about PM?

Community Champion

Private message*

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors