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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
SARAHCH
Frequent Visitor

Please Help - Incorrect Matrix Row Total

Hello, 

 

I have an issue with row total on my matrix, this is my mesure. The goal is to divide the total quantity which is generally equal to 1 every month except the current month I want to prorate it over the number of current days * calendar days.
For example :

SARAHCH_1-1719395178942.png

 

the total is equal to 6 so I want to have 5.83.

 

this is my measure : 

test =

VAR SelectedMonth = value(MAX('Calendrier'[l_month]))
VAR SelectedYear = value(MAX('Calendrier'[l_year]))
VAR IsCurrentMonthYear = SelectedMonth = MONTH(TODAY()) && SelectedYear = YEAR(TODAY())
VAR QteProrata = SUMX(
        VALUES('Facturation_Ordre'[tariff_item_name]),
        IF(
            SelectedMonth = MONTH(TODAY()) && SelectedYear = YEAR(TODAY()),
            DIVIDE([Qté_Prorata_Month], [Nbr_Jours_Calendaires]) * DAY(TODAY()),
            [Qté_Prorata_Month]
        )
    )

RETURN

 IF(
        SelectedMonth = MONTH(TODAY()) && SelectedYear = YEAR(TODAY()),
SUMX(
    SUMMARIZE(
        'Facturation_Ordre',
        'Facturation_Ordre'[tariff_item_name],
        "TotalAmount",
        SUMX(
            FILTER('Facturation_Ordre', 'Facturation_Ordre'[tariff_item_name] = EARLIER('Facturation_Ordre'[tariff_item_name])),
   
        DIVIDE(SUMX(VALUES('Facturation_Ordre'[tariff_item_name]), [Qté_Prorata_Month]), [Nbr_Jours_Calendaires]) * DAY(TODAY())
       
           
    )),
    [TotalAmount]
),[Qte_Prorata_Month])

 

 

for info :

 [Qte_Prorata_Month] = 

VAR NbrSemaine = [Nbr Semaine]
VAR nature = MAX('Facturation_Ordre'[nature])
VAR IsMonthLevel = NOT ISFILTERED('HU_all'[Num_Week])

RETURN
IF(
    IsMonthLevel,
    SUMX(VALUES('Facturation_Ordre'[tariff_item_name]), [TotalQte]),
    IF(
        nature = "Fixe",
        DIVIDE(SUMX(VALUES('Facturation_Ordre'[tariff_item_name]), [TotalQte]), NbrSemaine),
       
            SUMX(VALUES('Facturation_Ordre'[tariff_item_name]), [TotalQte])
        )
    )
 
 
thank you for your help 
1 REPLY 1
Anonymous
Not applicable

Hi, @SARAHCH 

Are you able to share the pbix file or data table without sensitive data for testing purposes.

 

Best Regards,
Yang

Community Support Team

 



Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.