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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Gaston78
Frequent Visitor

Power BI : récupérer une variable an format texte dans un calcul filtré

Bonjour,

 

Je souhaiterais récupérer la valeur de la variable au format texte afin de pouvoir réaliser mon calcul filtré avec la variable.

Le résultat suivant n'affiche rien. La variable mois retourne bien le mois de juin par exemple.

 
joursOuvres mois = VAR
mois = MID(MIN('Xcplt : libellés en-têtes rapport M-1'[Libellés des en-têtes]),2,10)
RETURN
CALCULATE(
SUM('Xcplt : calendrier'[JoursOuvres]),
'Xcplt : calendrier'[MoisNom]=mois
)
 
ça fonctionne avec 'Xcplt : calendrier'[MoisNom]="juin"
 
Merci pour votre aide. 🙂
1 ACCEPTED SOLUTION

correct DAX :

I had a space before name of month then i modified MID formula in replace 2 by 3

 

joursOuvres mois = VAR
mois = MID(MIN('Xcplt : libellés en-têtes rapport M-1'[Libellés des en-têtes]),3,10)
RETURN
CALCULATE(
SUM('Xcplt : calendrier'[JoursOuvres]),
'Xcplt : calendrier'[MoisNom]=mois
)

View solution in original post

3 REPLIES 3
Payeras_BI
Solution Sage
Solution Sage

Hi @Gaston78 ,

 

MID ( <Text>, <StartPosition>, <NumberOfCharacters> )

 

In your VAR mois the number of characters is set to be always 10.

Is this correct? E.g. juin is only 4.

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

Hi,

Yes these are the months of the year and the month of December has 10 characters.

I would like to put the month variable with quotation marks.

Thanks for your help 🙂

I wish you a good day.

 

correct DAX :

I had a space before name of month then i modified MID formula in replace 2 by 3

 

joursOuvres mois = VAR
mois = MID(MIN('Xcplt : libellés en-têtes rapport M-1'[Libellés des en-têtes]),3,10)
RETURN
CALCULATE(
SUM('Xcplt : calendrier'[JoursOuvres]),
'Xcplt : calendrier'[MoisNom]=mois
)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.