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
Louay
New Member

Cumul des actions

Cumul act =
VAR SelectedOrigine = SELECTEDVALUE('Cumul Actions'[Origine première])
VAR SelectedProcessus = SELECTEDVALUE('Cumul Actions'[Processus])

RETURN
IF (
    ISFILTERED('Cumul Actions'[Origine première]) && ISFILTERED('Cumul Actions'[Processus]) ,
    CALCULATE (
        COUNT('Cumul Actions'[Processus]),
        FILTER (
            ALL('Cumul Actions'),
            'Cumul Actions'[Date] <= MAX('Cumul Actions'[Date])
                && 'Cumul Actions'[Origine première] = SelectedOrigine
                && 'Cumul Actions'[Processus] = SelectedProcessus
        )
    ),
    CALCULATE (
        COUNT('Cumul Actions'[Processus]),
        FILTER (
            ALL('Cumul Actions'),
            'Cumul Actions'[Date] <= MAX('Cumul Actions'[Date])
        )
    )
)
 
Bonjour, J'ai utiliser ce code pour calculer le cumul des action au cours du temps tout en prendre en consideration des filtres processus et origine premiere selectionné(s). Sans selectionné auccun filtre ça marche correctement et calculer le cumul générale mais lors de selection d'un ou plusieurs filtres il affiche seulement les mois concernés par ce filtre mais avec les valeurs generales.
Louay_0-1708347375338.png

 

Louay_1-1708347400908.png

 

1 ACCEPTED SOLUTION
Louay
New Member

I find the solution 

Cumuls des actions =
VAR SelectedOrigine = SELECTEDVALUE('Actions'[Origine première])
VAR SelectedProcessus = SELECTEDVALUE('Actions'[Processus])

RETURN
IF (
    ISFILTERED('Actions'[Origine première]) && ISFILTERED('Actions'[Processus]),
    CALCULATE (
        COUNT('Actions'[Processus]),
        FILTER (
            ALLSELECTED('Actions'),
            'Actions'[Année/Mois] <= MAX('Actions'[Année/Mois])
                && 'Actions'[Origine première] = SelectedOrigine
                && 'Actions'[Processus] = SelectedProcessus
        )
    ),
    CALCULATE (
        COUNT('Actions'[Processus]),
        FILTER (
            ALLSELECTED('Actions'),
            'Actions'[Année/Mois] <= MAX('Actions'[Année/Mois])
        )
    )
)

View solution in original post

2 REPLIES 2
Louay
New Member

I find the solution 

Cumuls des actions =
VAR SelectedOrigine = SELECTEDVALUE('Actions'[Origine première])
VAR SelectedProcessus = SELECTEDVALUE('Actions'[Processus])

RETURN
IF (
    ISFILTERED('Actions'[Origine première]) && ISFILTERED('Actions'[Processus]),
    CALCULATE (
        COUNT('Actions'[Processus]),
        FILTER (
            ALLSELECTED('Actions'),
            'Actions'[Année/Mois] <= MAX('Actions'[Année/Mois])
                && 'Actions'[Origine première] = SelectedOrigine
                && 'Actions'[Processus] = SelectedProcessus
        )
    ),
    CALCULATE (
        COUNT('Actions'[Processus]),
        FILTER (
            ALLSELECTED('Actions'),
            'Actions'[Année/Mois] <= MAX('Actions'[Année/Mois])
        )
    )
)
amitchandak
Super User
Super User

@Louay , In such case, it is better to have a separate date table, joined with the date of your table. And use fields of date table in measure, visual, and slicers

 

Then you can use measures like

 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))

Cumm Based on Date = CALCULATE([Net], Window(1,ABS,0,REL, ALL('date'[date]),ORDERBY('Date'[date],ASC)))

Cumm Based on Date = CALCULATE([Net], Window(1,ABS,0,REL, ALLSELECTED('date'[date]),ORDERBY('Date'[date],ASC)))

 

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

 

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.