The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Dear Colleagues could you help me with DAX Mesure!
As per the table below, i would like to disply separtly "Current" and "Previously" percentage of each country
Exemple for CD | % |
% Previously date | 60% |
% Max date: | 100% |
Country Date %
CD | 05/02/2023 | 95% |
MU | 11/07/2023 | 22% |
CD | 18/12/2023 | 60% |
CD | 23/02/2024 | 100% |
MU | 02/05/2024 | 17% |
Solved! Go to Solution.
Your solution is great @sanalytics , Allow me to offer another insight:
Hi, @dofrancis3
Based on your description, I used the following sample data:
To make it more realistic for you, I've created a measure using a percentage column.
I created two measures using the following two DAX expressions.
Current Percentage =
VAR MaxDate = CALCULATE ( MAX ( 'Table'[Date]), ALLEXCEPT('Table','Table'[Country] ))
RETURN
CALCULATE (
[PercentageMeasure],
'Table'[Date] = MaxDate
)
Previous Percentage =
VAR MaxDate = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT('Table','Table'[Country] ))
VAR PrevDate = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT('Table','Table'[Country] ), 'Table'[Date] < MaxDate )
RETURN
CALCULATE (
[PercentageMeasure],
'Table'[Date] = PrevDate
)
Here are the results:
I've provided the PBIX file used this time below.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Your solution is great @sanalytics , Allow me to offer another insight:
Hi, @dofrancis3
Based on your description, I used the following sample data:
To make it more realistic for you, I've created a measure using a percentage column.
I created two measures using the following two DAX expressions.
Current Percentage =
VAR MaxDate = CALCULATE ( MAX ( 'Table'[Date]), ALLEXCEPT('Table','Table'[Country] ))
RETURN
CALCULATE (
[PercentageMeasure],
'Table'[Date] = MaxDate
)
Previous Percentage =
VAR MaxDate = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT('Table','Table'[Country] ))
VAR PrevDate = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT('Table','Table'[Country] ), 'Table'[Date] < MaxDate )
RETURN
CALCULATE (
[PercentageMeasure],
'Table'[Date] = PrevDate
)
Here are the results:
I've provided the PBIX file used this time below.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can try below measure
Previous Value =
CALCULATE(
SUM( 'Table'[Perc] ),
OFFSET(
-1,
SUMMARIZE( ALL( 'Table' ),'Table'[Country],'Table'[Date], 'Table'[MaxTag] ),
ORDERBY( 'Table'[Date], ASC ),PARTITIONBY('Table'[Country] )
) )
Hope it helps.
Regards
sanalytics
Dear @sanalytics thank you for your suport !
But please how can i do in case the % column is a Mesure?
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |